Main Content

reset

R2026b

Clear 3D primitives from RoadRunner Viewer scene graph

Since R2026b

    Syntax

    Description

    reset(pc) clears all 3D primitives in the specified PrimitiveCollection object pc from the RoadRunner Viewer scene graph. This function clears only 3D primitives from the specified primitive collection. It does not clear any other scene graph objects, such as 3D meshes or overlays, or any 3D primitives in unspecified PrimitiveCollection objects.

    example

    Examples

    collapse all

    Use a PrimitiveCollection object to draw a series of point primitives in the RoadRunner Viewer scene graph, and then use reset to clear the primitives from the PrimitiveCollection object. 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 draw 3D primitives, such as points, in the RoadRunner Viewer scene graph, use addPrimitive to create a PrimitiveCollection object, pc.

    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 locations 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 the scene graph and view the newly added primitives, use the drawnow function.

    drawnow(rrViewer)

    To clear the scene graph of the 3D primitives, use reset and specify the PrimitiveCollection object pc.

    reset(pc)

    Use drawnow to update the scene graph and show the changes.

    drawnow(rrViewer)

    Input Arguments

    collapse all

    Primitive collection from which to remove 3D primitives, specified as a PrimitiveCollection object.

    Limitations

    • Note that you cannot specify single primitives or primitive types within a primitive collection to clear. For example, if your PrimitiveCollection object contains points, lines, and triangles, you cannot specify for RoadRunner Viewer to remove only the points.

    Version History

    Introduced in R2026b