Main Content

scale

Scale mesh in each dimension

Since R2020a

Description

scaledMesh = scale(mesh,scaleFactor) scales the object mesh by scaleFactor. scaleFactor can be the same for all dimensions or defined separately as elements of a 1-by-3 vector in the order x, y, and z.

example

scaledMesh = scale(mesh,[sx sy sz]) scales the object mesh along the dimensions x, y, and z by the scaling factors sx, sy, and sz.

Examples

collapse all

Create an extendedObjectMesh object and scale the object.

Construct a cuboid mesh of unit dimensions.

 cuboid = extendedObjectMesh('cuboid');

Scale the mesh by different factors along each of the three axes.

scaledCuboid = scale(cuboid,[100 30 20]);

Visualize the mesh.

show(scaledCuboid);

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

Input Arguments

collapse all

Extended object mesh, specified as an extendedObjectMesh object.

Scaling factor for the object mesh, specified as a positive real scalar or as a 1-by-3 vector in the order x, y, and z.

Data Types: single | double

Scaling factor for x-axis, specified as a positive real scalar.

Data Types: single | double

Scaling factor for y-axis, specified as a positive real scalar.

Data Types: single | double

Scaling factor for z-axis, specified as a positive real scalar.

Data Types: single | double

Output Arguments

collapse all

Scaled object mesh, returned as an extendedObjectMesh object.

Version History

Introduced in R2020a