Contenido principal

drawPoints

R2026b

Draw points in RoadRunner Viewer scene graph

Since R2026b

    Description

    drawPoints(pc,points,color,size) draws point primitives of the specified size and color at the specified positions points, using world coordinates, in the specified primitive collection pc in the RoadRunner Viewer scene graph.

    example

    Examples

    collapse all

    Use a PrimitiveCollection object and the drawPoints function to draw a row of red points along the x-axis of the RoadRunner Viewer scene graph. This example assumes you have already added the folder containing the RoadRunner API to your MATLAB® path. For information on getting started with RoadRunner Viewer, see Get Started with RoadRunner Viewer (RoadRunner Scenario).

    Open RoadRunner Viewer and create a roadrunnerViewer object rrViewer.

    rrViewer = roadrunnerViewer;

    To create a PrimitiveCollection object, pc, use the addPrimitive function and specify the roadrunnerViewer object rrViewer.

    pc = addPrimitive(rrViewer);

    Draw a row of red points along the x-axis of the scene graph. Use the drawPoints function and specify the primitive collection pc, the point positions pts, the point color, and the point size.

    pts = [0 0 0; 1 0 0; 2 0 0];
    drawPoints(pc,pts,[1 0 0],10);

    To update RoadRunner Viewer and view the changes to the primitives, use the drawnow function.

    drawnow(rrViewer)

    Input Arguments

    collapse all

    Primitive collection in which to add points, specified as a PrimitiveCollection object.

    Point positions, in world coordinates, specified as an N-by-3 matrix. N is the number of points and the columns [x y z] represent the x-, y-, and z-positions of each point, respectively.

    Point color, specified as a four-element vector of the form [R,G,B,A], a three-element vector of the form [R,G,B], a string scalar, or a character vector. If specified as a vector, R, G, B, and A represent the red, green, blue, and alpha values for the point color, respectively. If specified as a string scalar or character vector, you must use a color name, such as "blue", or a hexadecimal value, such as "#0072BD".

    This table lists the named color options, the equivalent RGBA values, and the hexadecimal color codes.

    Color NameShort NameRGBA ValueHexadecimal Color CodeAppearance
    "red""r"[1 0 0 1]"#FF0000"

    Sample of the color red

    "green""g"[0 1 0 1]"#00FF00"

    Sample of the color green

    "blue""b"[0 0 1 1]"#0000FF"

    Sample of the color blue

    "cyan" "c"[0 1 1 1]"#00FFFF"

    Sample of the color cyan

    "magenta""m"[1 0 1 1]"#FF00FF"

    Sample of the color magenta

    "yellow""y"[1 1 0 1]"#FFFF00"

    Sample of the color yellow

    "black""k"[0 0 0 1]"#000000"

    Sample of the color black

    "white""w"[1 1 1 1]"#FFFFFF"

    Sample of the color white

    Point size, specified as a numeric scalar, in pixels.

    Version History

    Introduced in R2026b