Body Fixed Group

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.body_fixed.BodyFixedGroup(entities, **kwargs)[source]

Group of body fixed entities so that rendering occures in the body frame, allowing for the bounding volume heirarchy to be cached inbetween renderings

Parameters

entities (Union[BodyFixedEntity, List[BodyFixedEntity], Tuple[BodyFixedEntity,...]]) – BodyFixedEntity/Entities against which ray tracing is performed

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

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.

transform_to_body(position, rotation)[source]

Transform provided position and rotation into the body fixed frame

Parameters
  • position (ArrayLike) – Input position represented in the base reference frame

  • rotation (ArrayLike) – Input rotation represented in the base reference frame

Returns

position and rotation transformed into the body fixed frame

Return type

Tuple[np.ndarray, np.ndarray]

render(camera, lights, min_samples=1, max_samples=1, noise_threshold=1.0, num_bounces=1)[source]

Render a scene with a set of grouped body fixed entities.

Parameters
  • camera (Camera) – Camera model to be used for generatring rays

  • lights (Union[Light, List[Light], Tuple[Light,...]]) – ight(s) to be used for rendering

  • min_samples (int, optional) – Minimum number of ray samples per pixel

    Default: 1

  • max_samples (int, optional) – Maximum number of ray samples per pixel

    Default: 1

  • noise_threshold (float, optional) – Pixel noise threshold for adaptive sampling

    Default: 1

  • num_bounces (int, optional) – Number of ray bounces

    Default: 1

Returns

Rendered image

Return type

np.ndarray

normal_pass(camera, return_image=False)[source]

Perform a normal pass with body fixed entities

Parameters
  • camera (Camera) – Camera model to be used for generating rays

  • return_image (bool, optional) – Flag to return an image representation of the intersected normals

    Default: False

Returns

An array of the intersected normals. If return_image is set to True, then an image where the normal XYZ values are represented using RGB color values is returned as a second output.

Return type

Union[np.ndarray, Tuple(np.ndarray, np.ndarray)]

intersection_pass(camera, return_image=False)[source]

Perform a normal pass with body fixed entities

Parameters
  • camera (Camera) – Camera model to be used for generating rays

  • return_image (bool, optional) – Flag to return an image representation of the intersection depth

    Default: False

Returns

An array of the intersected points. If return_image is set to True, then an image where the distance to each intersected point is represented via pixel intensity is returned as a second output.

Return type

Union[np.ndarray, Tuple(np.ndarray, np.ndarray)]

instance_pass(camera, return_image=False)[source]

Perform an instance segmentation pass with body fixed entities

Parameters
  • camera (Camera) – Camera model to be used for generating rays

  • return_image (bool, optional) – Flag to return an image representation of the instances

    Default: False

Returns

An array unique id codes for each unique entity intersected. If return_image is set to True, then an image where each unique id is represented with a unique RGB color is returned as a second output.

Return type

Union[np.ndarray, Tuple(np.ndarray, np.ndarray)]