Main Content

scaleToFit

Auto-scale object mesh to match specified cuboid dimensions

Description

example

scaledMesh= scaleToFit(mesh,dims)auto-scales the object mesh to match the dimensions of a cuboid specified in the structuredims.

Examples

collapse all

Create anextendedObjectMeshobject 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 indims.

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.

Input Arguments

collapse all

Extended object mesh, specified as anextendedObjectMeshobject.

Dimensions of the cuboid to scale an object mesh, specified as astructwith these fields:

  • Length– Length of the cuboid

  • Width– Width of the cuboid

  • Height– Height of the cuboid

  • OriginOffset——在3 d coordi起源抵消nates

All the dimensions are in meters.

Data Types:struct

Output Arguments

collapse all

Scaled object mesh, returned as anextendedObjectMeshobject.

Version History

Introduced in R2020a