Contenido principal

Surface

R2026b

Display and modify surface meshes in pcviewer

Since R2026b

    Description

    A Surface object represents a surface mesh in a pcviewer scene. The addSurfaceMesh object function returns a Surface object when you add a surface mesh to a pcviewer object. You can use the properties of the Surface object to access the associated mesh data and control the appearance and behavior of the surface in the scene.

    Properties

    expand all

    This property is read-only.

    Point cloud data, specified as a Surface or triangulation object.

    Color for points in the point cloud, specified as a short name, long name, RGB triplet, or an M-by-3 matrix. The color input sets the Color property. For more information on color values, see Color Values on the pcviewer reference page.

    • If the data type of the Location property of the input point cloud is single or double, each RGB value must be in the range [0, 1].

    • If the data type of the Location property of the input point cloud is uint8, each color RGB value must be in the range [0, 255].

    • The Color property of the Points object stores the color value as an RGB triplet, an M-by-3 matrix, or an M-by-N-by-3 array. If you specify one or more color names, the function converts them to their corresponding RGB triplets.

    ColorFormatExample
    Specify one color for all points

    Short or long color name.

    "r"

    "red"

    RGB triplet, as a 1-by-3 vector.

    [255 0 0]1-by-3 grid, with columns labeled r, g, and b respectively.

    Specify a color for each point

    Vector of strings, or cell array of character vectors of color names.

    ["red","yellow","blue"]

    M-by-3 matrix for an unorganized point cloud, in which each row is an RGB triplet. M is the number of rows in the unorganized point cloud.

    255 0 0
    255 0 0
    0 255 255
    M-by-3 grid, with columns labeled r,g,b respectively.

    M-by-N-by-3 array for an organized point cloud, in which each page specifies the red, green, or blue value for the corresponding point in the point cloud. M-by-N is the size of the organized point cloud.

    M-by-N-by3 grid, with 3 m-by-n matrices labeled r, g, and b respectively.

    Source of the color data, specified as one of:

    • "auto" — Uses the Color property of the input point cloud, if available. Otherwise, uses "Intensity" if available. If neither is available, uses the z-coordinates of the vertices.

    • "X" — Use the x-coordinates of the mesh vertices.

    • "Y" — Use the y-coordinates of the mesh vertices.

    • "Z" — Use the z-coordinates of the mesh vertices.

    • "FaceColor" — Use values from the FaceColors property of the SurfaceMesh object.

    • "VertexColor" — Use values from the VertexColors property of the SurfaceMesh object.

    • "Custom" — Use the values specified by the Color property.

    Point size, specified as a positive scalar in pixels.

    Transformation applied to the point cloud in the scene, specified as a rigidtform3d (Image Processing Toolbox), affinetform3d (Image Processing Toolbox), simtform3d (Image Processing Toolbox), or transltform3d (Image Processing Toolbox).

    Transparency of point cloud, specified as a numeric scalar in the range [0,1].

    Display point cloud in scene, specified as "on" or "off", or as a numeric or logical 0 (false) or 1 (true). A value of "on" is equivalent to true and shows the points magnified. A value of "off" is equivalent to false and shows points unmagnified, as they would appear from the position of the camera.

    Examples

    collapse all

    Download two point cloud tiles from the U.S. Geological Survey (USGS) 3D Elevation Program (3DEP) [1], covering the University of Utah campus and adjacent Wasatch Mountain foothills. Visualize each tile individually, then combine them in a single viewer using the addPointCloud method.

    baseURL = "https://rockyweb.usgs.gov/vdelivery/Datasets/Staged/Elevation/LPC/Projects/Wasatch_Fault_UT_LiDAR/UT_Wasatch_L4_2013/LAZ/";
    
    tiles = [
        "USGS_LPC_Wasatch_Fault_UT_LiDAR_12TVL2900012000.laz"
        "USGS_LPC_Wasatch_Fault_UT_LiDAR_12TVL3000012000.laz"
    ];

    Download the tiles if they are not already cached locally.

    for i = 1:numel(tiles)
        localFile = fullfile(tempdir, tiles(i));
        if ~exist(localFile,"file")
            websave(localFile, baseURL + tiles(i));
        end
    end

    Read the two tiles as point clouds.

    reader1 = lasFileReader(fullfile(tempdir, tiles(1)));
    pc1 = readPointCloud(reader1);
    
    reader2 = lasFileReader(fullfile(tempdir, tiles(2)));
    pc2 = readPointCloud(reader2);

    Visualize the first tile in its own pcviewer instance.

    pcview1 = pcviewer(pc1);

    Visualize the second tile in its own pcviewer instance.

    pcview2 = pcviewer(pc2);

    Use addPointCloud to add the second point cloud to a viewer that already displays the first. This avoids concatenating the point clouds and lets you control each one independently.

    pcview = pcviewer(pc1);

    addPointCloud(pcview, pc2);

    References

    [1] USGS Lidar Point Cloud UT_Wasatch_L4_2013 courtesy of the U.S. Geological Survey

    Version History

    Introduced in R2026b

    See Also

    Objects

    Functions