Entity

Attributes Summary

crt.RigidBody.scale

Scale of the body (float)

crt.RigidBody.position

Position of the body (numpy.ndarray of shape (3,))

crt.RigidBody.rotation

Rotation of the body (numpy.ndarray of shape (3,3))

crt.RigidBody.name

NAIF name or ID code for the body (str)

crt.RigidBody.frame

NAIF reference frame name for the body (str)

crt.RigidBody.origin

NAIF name or ID code for the reference frame origin (str)

crt.RigidBody.ref

NAIF reference frame name (str)

crt.RigidBody.abcorr

Aberration correction flag (str)

Methods Summary

crt.RigidBody.set_scale

Set a new scale

crt.RigidBody.set_position

Set a new position

crt.RigidBody.set_rotation

Set a new rotation

crt.RigidBody.set_pose

Set both a new position and rotation

crt.RigidBody.spice_position

Set new position for a given ephemeris time using SPICE

crt.RigidBody.spice_rotation

Set new rotation for a given ephemeris time using SPICE

crt.RigidBody.spice_pose

Set both a new position and rotation for a given ephemeris time using SPICE

class crt.Entity(geometry_path, color=[1, 1, 1], geometry_type='obj', smooth_shading=False, **kwargs)[source]

The Entity class stores all mesh, material, and texture information for a body.

Parameters
  • geometry_path (str) – Path to the mesh geometry to be loaded

  • color (ArrayLike, optional) – The RGB color code of the geometry

    Default: [1,1,1]

  • geometry_type (str, optional) – The format of the mesh geoemtry provided

    Default: "obj"

  • smooth_shading (bool, optional) – Flag to enable smooth shading via vertex normal interpolation

    Default: False

geometry_path

Path to the geometry (str)

geometry_type

Format of the provided geometry file (str)

set_pose(position, rotation, cpp=True)

Set both a new position and rotation

Parameters
  • position (ArrayLike) – Position to be applied (xyz)

  • rotation (ArrayLike) – 3 by 3 Rotation matrix that must obey \(R^T = R^{-1}\) and \(\det(R)=1\)

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

set_position(position, cpp=True)

Set a new position

Parameters
  • position (ArrayLike) – Position to be applied (xyz)

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

set_rotation(rotation, cpp=True)

Set a new rotation

Parameters
  • rotation (ArrayLike) – 3 by 3 Rotation matrix that must obey \(R^T = R^{-1}\) and \(\det(R)=1\)

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

set_scale(scale, cpp=True)

Set a new scale

Parameters
  • scale (float) – Scale to be applied

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

spice_pose(et, cpp=True)

Set both a new position and rotation for a given ephemeris time using SPICE

The position is updated using spiceypy.spkpos(), where the name is used as the targ argument, ref is used as the ref argument, abcorr is used as the abcorr argument, and origin is used as the obs argument.

The rotation is updated using spiceypy.pxform(), where the ref is used as the from argument, and frame is used as the to argumnet.

Please refer to the spkpos or pxform documentation for more information.

Parameters
  • et (float) – Ephemeris time (seconds since the J2000 epoch), also known as Barycentric Dynamical Time

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

spice_position(et, cpp=True)

Set new position for a given ephemeris time using SPICE

This is done using spiceypy.spkpos(), where the name is used as the targ argument, ref is used as the ref argument, abcorr is used as the abcorr argument, and origin is used as the obs argument. Please refer to the spkpos documentation for more information.

Parameters
  • et (float) – Ephemeris time (seconds since the J2000 epoch), also known as Barycentric Dynamical Time

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

spice_rotation(et, cpp=True)

Set new rotation for a given ephemeris time using SPICE

This is done using spiceypy.pxform(), where the ref is used as the from argument, and frame is used as the to argumnet. Please refer to the pxform documentation for more information.

Parameters
  • et (float) – Ephemeris time (seconds since the J2000 epoch), also known as Barycentric Dynamical Time

  • cpp (bool, optional) – Flag for if the underlying C++ body should be updated

    Default: True

color

RGB Color code for the geometry (ArrayLike)

scale

Scale of the body (float)

This attribute is used by the subclass Entity and describes how the Entity geometry is scaled. It can be modified directly using set_scale().

position

Position of the body (numpy.ndarray of shape (3,))

This attribute is used by the subclass Entity, as well as all Camera and Light classes. It describes how the body is translated in space. It can be modified directly using either set_position() or set_pose(). Alternatively, it can be modified using spice_position() which uses predefined SPICE ephemerides to calculate a position for a given ephemeris time.

rotation

Rotation of the body (numpy.ndarray of shape (3,3))

This attribute is used by the subclasses Entity, as well as all Camera and Light classes. It describes how the body is translated in space. It can be modified directly using either set_rotation() or set_pose(). Alternatively, it can be modified using spice_rotation() which uses predefined SPICE ephemerides to calculate a rotation for a given ephemeris time.

name

NAIF name or ID code for the body (str)

This attribute can be used by the subclasses Entity, as well as all Camera and Light classes. It is used by the SPICE utility, spiceypy.spkpos(), as the name for the celestial body whose position will be used as the position of the body. This corresponds to the targ argument to spiceypy.spkpos(). Please refer to the spkpos documentation for more information.

frame

NAIF reference frame name for the body (str)

This attribute can be used by the subclasses Entity, as well as all Camera and Light classes. It is used by the SPICE utility, spiceypy.pxform(), as the name for the reference frame whose orientation will be used as the rotation of the body. This corresponds to the to argument to spiceypy.pxform(). Please refer to the pxform documentation for more information.

origin

NAIF name or ID code for the reference frame origin (str)

This attribute can be used by the subclasses Entity, as well as all Camera and Light classes. It is used by the SPICE utility, spiceypy.spkpos(), as the name for the celestial body whose position will be used as the origin of the reference frame. This corresponds to the obs argument to spiceypy.spkpos(). Please refer to the spkpos documentation for more information.

ref

NAIF reference frame name (str)

This attribute can be used by the subclasses Entity, as well as all Camera and Light classes. It is used by both the SPICE utilities, spiceypy.pxform() and spiceypy.spkpos(), as the name for the reference frame against in which positions and rotations will be calculated. This corresponds to the ref argument to both spiceypy.spkpos() and spiceypy.pxform(). Please refer to the spkpos or pxform documentation for more information.

abcorr

Aberration correction flag (str)

This attribute is used by by the SPICE utility, spiceypy.spkpos(), as an indication of what light time correction should be used. This corresponds to the abcorr argument to spiceypy.spkpos(). Please refer to the spkpos documentation for more information.

smooth_shading

Flag to enable smooth shading via vertex normal interpolation (bool)