Body Fixed Group
Attributes Summary
Scale of the body ( |
|
Position of the body ( |
|
Rotation of the body ( |
|
NAIF name or ID code for the body ( |
|
NAIF reference frame name for the body ( |
|
NAIF name or ID code for the reference frame origin ( |
|
NAIF reference frame name ( |
|
Aberration correction flag ( |
Methods Summary
Set a new |
|
Set a new |
|
Set a new |
|
Set new position for a given ephemeris time using SPICE |
|
Set new rotation for a given ephemeris time using SPICE |
|
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
androtation
- 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 thename
is used as thetarg
argument,ref
is used as theref
argument,abcorr
is used as theabcorr
argument, andorigin
is used as theobs
argument.The rotation is updated using
spiceypy.pxform()
, where theref
is used as thefrom
argument, andframe
is used as theto
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 thename
is used as thetarg
argument,ref
is used as theref
argument,abcorr
is used as theabcorr
argument, andorigin
is used as theobs
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 theref
is used as thefrom
argument, andframe
is used as theto
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 theEntity
geometry is scaled. It can be modified directly usingset_scale()
.
- position
Position of the body (
numpy.ndarray
of shape(3,)
)This attribute is used by the subclass
Entity
, as well as allCamera
andLight
classes. It describes how the body is translated in space. It can be modified directly using eitherset_position()
orset_pose()
. Alternatively, it can be modified usingspice_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 allCamera
andLight
classes. It describes how the body is translated in space. It can be modified directly using eitherset_rotation()
orset_pose()
. Alternatively, it can be modified usingspice_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 allCamera
andLight
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 thetarg
argument tospiceypy.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 allCamera
andLight
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 theto
argument tospiceypy.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 allCamera
andLight
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 theobs
argument tospiceypy.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 allCamera
andLight
classes. It is used by both the SPICE utilities,spiceypy.pxform()
andspiceypy.spkpos()
, as the name for the reference frame against in which positions and rotations will be calculated. This corresponds to theref
argument to bothspiceypy.spkpos()
andspiceypy.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 theabcorr
argument tospiceypy.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 toTrue
, 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 toTrue
, 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 toTrue
, 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)]