Main Content


Crop surface mesh

Since R2022b



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


    collapse all

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

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

    Display the surface mesh.

    surfaceMeshShow(sphereMesh,Title="Original Mesh")

    Figure Original Mesh contains an object of type images.ui.graphics3d.viewer3d.

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

    bbox3d = [-1 1 -1 1 -1 0];

    Display the cropped mesh.

    surfaceMeshShow(sphereMesh, Title="Cropped mesh")

    Figure Cropped mesh contains an object of type images.ui.graphics3d.viewer3d.

    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