Main Content

extendedObjectMesh

Mesh representation of extended object

Since R2022a

Description

The extendedObjectMesh represents the 3-D geometry of an object. The 3-D geometry is represented by faces and vertices. Use these object meshes to specify the geometry of an robotPlatform for simulating lidar sensor data using robotLidarPointCloudGenerator.

Creation

Description

example

mesh = extendedObjectMesh('cuboid') returns an extendedObjectMesh object, that defines a cuboid with unit dimensions. The origin of the cuboid is located at its geometric center.

example

mesh = extendedObjectMesh('cylinder') returns a hollow cylinder mesh with unit dimensions. The cylinder mesh has 20 equally spaced vertices around its circumference. The origin of the cylinder is located at its geometric center. The height is aligned with the z-axis.

mesh = extendedObjectMesh('cylinder',n) returns a cylinder mesh with n equally spaced vertices around its circumference.

example

mesh = extendedObjectMesh('sphere') returns a sphere mesh with unit dimensions. The sphere mesh has 119 vertices and 180 faces. The origin of the sphere is located at its center.

mesh = extendedObjectMesh('sphere',n) additionally allows you to specify the resolution, n, of the spherical mesh. The sphere mesh has (n + 1)2 - 2 vertices and 2n(n - 1) faces.

mesh = extendedObjectMesh(vertices,faces) returns a mesh from faces and vertices. vertices and faces set the Vertices and Faces properties respectively.

Properties

expand all

Vertices of the defined object, specified as an N-by-3 matrix of real scalars. N is the number of vertices. The first, second, and third element of each row represents the x-, y-, and z-position of each vertex, respectively.

Faces of the defined object, specified as a M-by-3 array of positive integers. M is the number of faces. The three elements in each row are the vertex IDs of the three vertices forming the triangle face. The ID of the vertex is its corresponding row number specified in the Vertices property.

Object Functions

Use the object functions to develop new meshes.

applyTransformApply forward transformation to mesh vertices
joinJoin two object meshes
rotateRotate mesh about coordinate axes
scaleScale mesh in each dimension
scaleToFitAuto-scale object mesh to match specified cuboid dimensions
showDisplay the mesh as a patch on the current axes
translateTranslate mesh along coordinate axes

Examples

collapse all

Create an extendedObjectMesh object and translate the object.

Construct a cuboid mesh.

mesh = extendedObjectMesh('cuboid');

Translate the mesh by 5 units along the negative y axis.

mesh = translate(mesh,[0 -5 0]);

Visualize the mesh.

ax = show(mesh);
ax.YLim = [-6 0];

Figure contains an axes object. The axes object contains an object of type patch.

Create an extendedObjectMesh object and visualize the object.

Construct a cylinder mesh.

mesh = extendedObjectMesh('cylinder');

Visualize the mesh.

ax = show(mesh);

Figure contains an axes object. The axes object contains an object of type patch.

Create an extendedObjectMesh object and auto-scale the object to the required dimensions.

Construct a sphere mesh of unit dimensions.

sph = extendedObjectMesh('sphere');

Auto-scale the mesh to the dimensions in dims.

dims = struct('Length',5,'Width',10,'Height',3,'OriginOffset',[0 0 -3]);
sph = scaleToFit(sph,dims);

Visualize the mesh.

show(sph);

Figure contains an axes object. The axes object contains an object of type patch.

Version History

Introduced in R2022a