Main Content

scale

Scale vertices of surface mesh

Since R2022b

    Description

    scale(mesh,scalingFactor) scales the vertices of the surface mesh mesh along the x-, y-, z-axes by the specified scaling factor scalingFactor. The function uses the mesh origin as the pivot point.

    example

    scale(mesh,scalingFactor,pivot) scales the mesh vertices along the x-, y-, z-axes about the specified pivot point.

    Examples

    collapse all

    Define mesh vertices for a surface mesh.

    vertices = [1 -1  1; 1 1 1; -1 1 1; -1 -1 1; ...
                1 -1 -1; 1 1 -1; -1 1 -1; -1 -1 -1];

    Define the mesh faces using the vertices.

    faces = [6 2 1; 1 5 6; 8 4 3; 3 7 8; 6 7 3; 3 2 6; ...
             5 1 4; 4 8 5; 4 1 2; 2 3 4; 7 6 5; 5 8 7];

    Create and display the surface mesh.

    mesh = surfaceMesh(vertices,faces);
    surfaceMeshShow(mesh,Title="Original Mesh")

    Scale the vertices of the surface mesh by a factor of two, and display the scaled mesh.

    scalingFactor = 2;
    scale(mesh,scalingFactor)
    surfaceMeshShow(mesh,Title="Scaled Mesh")

    Input Arguments

    collapse all

    Surface mesh, specified as a surfaceMesh object.

    Scaling factor for the surface mesh, specified as a positive scalar.

    Data Types: single | double

    Pivot point for scaling the surface mesh, specified as a three-element vector of the form [x y z]. The values of the vector define the coordinates of the pivot point.

    Version History

    Introduced in R2022b