Skip to content

visualdynamics.viz.rigid

rigid

The reference point of a rigid-body preview, drawn on the scene.

A small sphere with three axis ticks at the point the rotations pivot on, so the pane's numbers have a place on the model. Sized from the model, never from the point's coordinates; excluded from the scene's bounds so it never resizes the axes, and unpickable so a click near it goes to the geometry — the same rules the stage marks live by.

Functions:

Name Description
add_reference_point

Draw the marker at point, in the scene's display units.

Functions:

add_reference_point

add_reference_point(
    plotter: Any,
    point: ArrayLike,
    model_size: float,
    color: Any,
) -> None

Draw the marker at point, in the scene's display units.

Source code in src/visualdynamics/viz/rigid.py
def add_reference_point(plotter: Any, point: ArrayLike, model_size: float,
                        color: Any) -> None:
    """Draw the marker at `point`, in the scene's display units."""
    import pyvista as pv

    centre = np.asarray(point, dtype=np.float64)
    radius = max(float(model_size) * RADIUS_FRACTION, 1e-9)
    reach = radius * TICK_RADII
    ends = np.array([centre - reach * axis for axis in np.eye(3)]
                    + [centre + reach * axis for axis in np.eye(3)])
    ticks = pv.PolyData(ends, lines=np.array([[2, 0, 3], [2, 1, 4],
                                              [2, 2, 5]]).ravel())
    for name, mesh, extra in (
            (NAME, pv.Sphere(radius=radius, center=centre), {}),
            (NAME + '-axes', ticks, {'line_width': 2.0})):
        actor = plotter.add_mesh(mesh, color=color, name=name,
                                 render=False, pickable=False, **extra)
        actor.UseBoundsOff()