solid Module

Solid objects are used by the segment module. A solid has a position, and orientation (defined by a rotation matrix). This module also contains the class definition for stadium objects, which are used to construct StadiumSolid solids. The Solid class has two subclasses: the StadiumSolid and Semiellipsoid classes.

class yeadon.solid.Semiellipsoid(label, density, baseperim, height)[source]

Bases: yeadon.solid.Solid

Semiellipsoid.

calc_rel_properties(self)[source]

Calculates mass, relative center of mass, and relative/local inertia, according to somewhat commonly availble formulae.

draw_mayavi(self, mlabobj, col)[source]

Draws the semiellipsoid in 3D using MayaVi.

Parameters:
mlabobj :

The MayaVi object we can draw on.

col : tuple (3,)

Color as an rgb tuple, with values between 0 and 1.

n_mesh_points = 30
class yeadon.solid.Solid(label, density, height)[source]

Bases: object

Solid. Has two subclasses, stadiumsolid and semiellipsoid. This base class manages setting orientation, and calculating properties.

alpha = 0.5
calc_properties(self)[source]

Sets the center of mass and inertia of the solid, both with respect to the fixed human frame.

center_of_mass

Center of mass of the solid, a np.ndarray of shape (3,1), in units of m, expressed in the global frame, from the bottom center of the pelvis (Ls0).

draw_mayavi(self, mlabobj, col)[source]
end_pos

Position of the point on the solid farthest from the origin along the longitudinal axis of the segment, a np.ndarray of shape (3,1), in units of m, expressed in the global frame, from the bottom center of the pelvis (Ls0).

inertia

Inertia matrix of the solid, a np.matrix of shape (3,3), in units of kg-m^2, about the center of mass of the human, expressed in the global frame.

mass

Mass of the solid, a float in units of kg.

pos

Position of the origin of the solid, which is the center of the surface closest to the pelvis, a np.ndarray of shape (3,1), in units of m, expressed in the global frame, from the bottom center of the pelvis (Ls0).

print_properties(self, precision=5, suppress=True)[source]

Prints mass, center of mass (in solid and global frames), and inertia (in solid and global frames).

The solid’s origin is at the bottom center of the proximal stadium (or stadium closest to the pelvis, Ls0).

Parameters:
precision : integer, default=5

The precision for floating point representation.

suppress : boolean, default=True

Print very small values as 0 instead of scientific notation.

Notes

See numpy.set_printoptions for more details on the optional arguments.

rel_center_of_mass

Center of mass of the solid, a np.ndarray of shape (3,1), in units of m, expressed in the frame of the solid, from the origin of the solid.

rel_inertia

Inertia matrix of the solid, a np.matrix of shape (3,3), in units of kg-m^2, about the center of mass of the solid, expressed in the frame of the solid.

set_orientation(self, proximal_pos, rot_mat, build_toward_positive_z)[source]

Sets the position, rotation matrix of the solid, and calculates the “absolute” properties (center of mass, and inertia tensor) of the solid.

Parameters:
proximal_pos : np.array (3,1)

Position of center of proximal end of solid in the absolute fixed coordinates of the human.

rot_mat : np.matrix (3,3)

Orientation of solid, with respect to the fixed coordinate system.

build_toward_positive_z : bool, optional

The order of the solids in the parent segment matters. By default they are stacked on top of each other in the segment’s local +z direction. If this is set to False, then they are stacked in the local -z direction. This is done so that, for example, in the default configuration, the arms are directed down.

class yeadon.solid.Stadium(label, inID, in1, in2=None, alignment='ML')[source]

Bases: object

Stadium, the 2D shape.

validStadiaLabels = {'La0': 'shoulder joint centre', 'La1': 'mid-arm', 'La2': 'elbow joint centre', 'La3': 'maximum forearm perimeter', 'La4': 'wrist joint centre', 'La5': 'base of thumb', 'La6': 'knuckles', 'La7': 'fingernails', 'Lb0': 'shoulder joint centre', 'Lb1': 'mid-arm', 'Lb2': 'elbow joint centre', 'Lb3': 'maximum forearm perimeter', 'Lb4': 'wrist joint centre', 'Lb5': 'base of thumb', 'Lb6': 'knuckles', 'Lb7': 'fingernails', 'Lj0': 'hip joint centre', 'Lj1': 'crotch', 'Lj2': 'mid-thigh', 'Lj3': 'knee joint centre', 'Lj4': 'maximum calf perimeter', 'Lj5': 'ankle joint centre', 'Lj6': 'heel', 'Lj7': 'arch', 'Lj8': 'ball', 'Lj9': 'toe nails', 'Lk0': 'hip joint centre', 'Lk1': 'crotch', 'Lk2': 'mid-thigh', 'Lk3': 'knee joint centre', 'Lk4': 'maximum calf perimeter', 'Lk5': 'ankle joint centre', 'Lk6': 'heel', 'Lk7': 'arch', 'Lk8': 'ball', 'Lk9': 'toe nails', 'Ls0': 'hip joint centre', 'Ls1': 'umbilicus', 'Ls2': 'lowest front rib', 'Ls3': 'nipple', 'Ls4': 'shoulder joint centre', 'Ls5': 'acromion', 'Ls6': 'beneath nose', 'Ls7': 'above ear'}
class yeadon.solid.StadiumSolid(label, density, stadium0, stadium1, height)[source]

Bases: yeadon.solid.Solid

Stadium solid. Derived from the solid class.

calc_rel_properties(self)[source]

Calculates mass, relative center of mass, and relative/local inertia, according to formulae in Appendix B of Yeadon 1990-ii. If the stadium solid is arranged anteroposteriorly, the inertia is rotated by pi/2 about the z axis.

draw_mayavi(self, mlabobj, col)[source]

Draws the initial stadium in 3D using MayaVi.

Parameters:
mlabobj : mayavi.soemthing

The MayaVi object we can draw on.

col : tuple (3,)

Color as an rgb tuple, with values between 0 and 1.