Core’s Plot Objects#

This module contains mixins that can be used to create plot objects with different backends by inheriting from the appropriate mixin and the backend’s PlotBase class.

Classes:

OriginMixin()

Mixin class adding an origin property to a plot object.

PlotBodyMixin(inertial_frame, zero_point, body)

Mixin class for plotting a body in 3D.

PlotFrameMixin(inertial_frame, zero_point, frame)

Mixin class for plotting a ReferenceFrame in 3D.

PlotLineMixin(inertial_frame, zero_point, line)

Mixin class for plotting lines in 3D.

PlotPointMixin(inertial_frame, zero_point, point)

Mixin class for plotting a Point in 3D.

PlotVectorMixin(inertial_frame, zero_point, ...)

Mixin class for plotting a Vector in 3D.

class symmeplot.core.plot_objects.OriginMixin#

Bases: object

Mixin class adding an origin property to a plot object.

Attributes:

origin

The origin of the object with respect to the zero_point.

property origin: Point#

The origin of the object with respect to the zero_point.

class symmeplot.core.plot_objects.PlotBodyMixin(inertial_frame: ReferenceFrame, zero_point: Point, body: Particle | RigidBody, name: str | None = None)#

Bases: object

Mixin class for plotting a body in 3D.

Notes

The subclass should instantiate the PlotFrame and PlotPoint objects in the constructor. If the body has a frame, then the PlotFrame should be the second child. The PlotPoint representing the center of mass should always be the first child.

Attributes:

body

The sympy body, which is being plotted.

plot_frame

PlotFrame used for plotting the reference frame of the body.

plot_masscenter

PlotPoint used for plotting the center of mass of the body.

property body: Particle | RigidBody#

The sympy body, which is being plotted.

property plot_frame: PlotBase | None#

PlotFrame used for plotting the reference frame of the body.

property plot_masscenter: PlotBase#

PlotPoint used for plotting the center of mass of the body.

class symmeplot.core.plot_objects.PlotFrameMixin(inertial_frame: ReferenceFrame, zero_point: Point, frame: ReferenceFrame, origin: Point | Vector | None = None, name: str | None = None, scale: float = 0.1)#

Bases: OriginMixin

Mixin class for plotting a ReferenceFrame in 3D.

Notes

The subclass should instantiate the PlotVector objects in the constructor. The children should be added in the following order: x, y, z.

Attributes:

frame

The sympy ReferenceFrame, which is being plotted.

origin

The origin of the object with respect to the zero_point.

vectors

The PlotVectors used to plot the reference frame.

x

PlotVector used for the unit vector in the x direction.

y

PlotVector used for the unit vector in the y direction.

z

PlotVector used for the unit vector in the z direction.

property frame: ReferenceFrame#

The sympy ReferenceFrame, which is being plotted.

property origin: Point#

The origin of the object with respect to the zero_point.

property vectors: tuple[PlotBase, PlotBase, PlotBase]#

The PlotVectors used to plot the reference frame.

property x: PlotBase#

PlotVector used for the unit vector in the x direction.

property y: PlotBase#

PlotVector used for the unit vector in the y direction.

property z: PlotBase#

PlotVector used for the unit vector in the z direction.

class symmeplot.core.plot_objects.PlotLineMixin(inertial_frame: ReferenceFrame, zero_point: Point, line: Iterable[Point], name: str | None = None)#

Bases: object

Mixin class for plotting lines in 3D.

Notes

The subclass should create and add the artist in the constructor.

Methods:

get_sympy_object_exprs()

Arguments of the sympy object artist in expression form.

Attributes:

line

The points that spawn the line.

line_coords

Coordinate values of the plotted line.

get_sympy_object_exprs() tuple[tuple[Expr, ...], ...]#

Arguments of the sympy object artist in expression form.

Notes

The form of the expression is ((x0, x1, ...), (y0, y1, ...), (z0, z1, ...)).

property line: tuple[Point, ...]#

The points that spawn the line.

property line_coords: ndarray[Any, dtype[float64]]#

Coordinate values of the plotted line.

class symmeplot.core.plot_objects.PlotPointMixin(inertial_frame: ReferenceFrame, zero_point: Point, point: Point, name: str | None = None)#

Bases: object

Mixin class for plotting a Point in 3D.

Notes

The subclass should create and add the artist in the constructor.

Methods:

get_sympy_object_exprs()

Get coordinate of the point as expressions.

Attributes:

point

The sympy Point, which is being plotted.

point_coords

Coordinate values of the plotted point.

get_sympy_object_exprs() tuple[Expr, Expr, Expr]#

Get coordinate of the point as expressions.

property point: Point#

The sympy Point, which is being plotted.

property point_coords: ndarray[Any, dtype[float64]]#

Coordinate values of the plotted point.

class symmeplot.core.plot_objects.PlotVectorMixin(inertial_frame: ReferenceFrame, zero_point: Point, vector: Vector, origin: Point | Vector | None = None, name: str | None = None)#

Bases: OriginMixin

Mixin class for plotting a Vector in 3D.

Notes

The subclass should create and add the artist in the constructor.

Methods:

get_sympy_object_exprs()

Arguments of the sympy object artist in expression form.

Attributes:

origin

The origin of the object with respect to the zero_point.

origin_coords

Coordinate values of the origin of the plotted vector.

vector

The sympy Vector, which is being plotted.

vector_values

Values of the plotted vector.

get_sympy_object_exprs() tuple[tuple[Expr, ...], tuple[Expr, ...]]#

Arguments of the sympy object artist in expression form.

property origin: Point#

The origin of the object with respect to the zero_point.

property origin_coords: ndarray[Any, dtype[float64]]#

Coordinate values of the origin of the plotted vector.

property vector: Vector#

The sympy Vector, which is being plotted.

property vector_values: ndarray[Any, dtype[float64]]#

Values of the plotted vector.