Translate a geometry by different distances along the x- and y-axes.
Create a model.
model = createpde;
Import and plot a geometry.
g = importGeometry(model,'PlateHolePlanar.stl'); pdegplot(g)
Mesh the geometry and plot the mesh.
generateMesh(model); figure pdemesh(model)
Translate the 2-D geometry by 1 along the x-axis and by 2 along the y-axis. Plot the result.
translate(g,[1 2]); pdegplot(g)
Plot the geometry and mesh. The
translate function modifies a geometry, but it does not modify a mesh.
figure pdegplot(g) hold on pdemesh(model)
After modifying the geometry, always regenerate the mesh.
generateMesh(model); figure pdegplot(g) hold on pdemesh(model)
Geometry, specified as a
s— Translation distance
Translation distance, specified as a vector of two or three real numbers. The distance is a vector of two elements for a 2-D geometry or three elements for a 3-D geometry. The elements specify the distance along the x-, y-, and, for a 3-D geometry, z-axes.
h— Modified geometry
Modified geometry, returned as a handle to the modified geometry object
translate does not work with
objects. See AnalyticGeometry Properties.
translate modifies a geometry, but it does not modify a mesh. After
modifying a geometry, regenerate the mesh to ensure a proper mesh association with the new