Main Content

crop

Crop surface mesh

Since R2022b

    Description

    crop(mesh,bbox)crops the surface mesh mesh to the region specified by the 3-D bounding box bbox.

    example

    Examples

    collapse all

    Read a surface mesh from a PLY file into the workspace.

    fileName = fullfile(toolboxdir("lidar"),"lidardata", ...
               "surfaceMesh","sphere.ply");
    sphereMesh = readSurfaceMesh(fileName);

    Display the surface mesh.

    removeDefects(sphereMesh,"unreferenced-vertices")
    surfaceMeshShow(sphereMesh,Title="Original Mesh")

    Define a bounding box to crop the sphere mesh to its lower half.

    bbox3d = [-1 1 -1 1 -1 0];
    crop(sphereMesh,bbox3d)

    Display the cropped mesh.

    removeDefects(sphereMesh,"unreferenced-vertices")
    surfaceMeshShow(sphereMesh, Title="Cropped mesh")

    Input Arguments

    collapse all

    Surface mesh, specified as a surfaceMesh object.

    3-D bounding box dimensions, specified as a six-element vector. The vector is of the form [minX maxX minY maxY minZ maxZ], specifying the minimum and maximum limits of the box along the x-,y-, z-directions.

    Version History

    Introduced in R2022b