applyTransform
Description
applies the forward transformation matrix transformedMesh
= applyTransform(mesh
,T
)T
to the vertices of the
object mesh.
Examples
Create and Transform Cuboid Mesh
Create an extendedObjectMesh
object and transform the object by using a transformation matrix.
Create a cuboid mesh of unit dimensions.
cuboid = extendedObjectMesh('cuboid');
Create a transformation matrix that is a combination of a translation, a scaling, and a rotation.
tform = makehgtform('translate',[0.2 -0.5 0.5], ... 'scale',[0.5 0.6 0.7], ... 'xrotate',pi/4);
Transform the mesh.
transformedCuboid = applyTransform(cuboid,tform);
Visualize the meshes.
subplot(1,2,1); show(cuboid); title('Initial Mesh') subplot(1,2,2); show(transformedCuboid); title('Transformed Mesh')
Input Arguments
mesh
— Extended object mesh
extendedObjectMesh
object
Extended object mesh, specified as an extendedObjectMesh
object.
T
— Transformation matrix
4-by-4 matrix
Transformation matrix applied on the object mesh, specified as a 4-by-4 matrix. The 3-D coordinates of each point in the object mesh is transformed according to this formula:
[xT; yT; zT; 1] = T*[x; y; z; 1]
xT
, yT
, and zT
are the
transformed 3-D coordinates of the point.
Data Types: single
| double
Output Arguments
transformedMesh
— Transformed object mesh
extendedObjectMesh
object
Transformed object mesh, returned as an extendedObjectMesh
object.
Version History
Introduced in R2020b
Apri esempio
Si dispone di una versione modificata di questo esempio. Desideri aprire questo esempio con le tue modifiche?
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)