Triangle64¶
giant.ray_tracer.shapes.triangle
:
- class giant.ray_tracer.shapes.triangle.Triangle64(self, vertices, albedos, facets, normals=None, compute_bounding_box=True, bounding_box=None, compute_reference_ellipsoid=True, reference_ellipsoid=None)¶
This class represents surfaces as tessellated triangles, storing the vertices, albedos, and normal vectors using double precision.
The surface is comprised of a
vertices
array, which is a nx3 double precision array specifying the vertices for the surface in the current frame, analbedos
double precision nx3 array or scalar representing the albedo for each vertex (if a scalar, then every vertex has the same albedo), anormals
mx3 double precision array representing the normal vector for each triangle, and afacets
mx3 facet map which indexes into thevertices
andalbedos
arrays to specify the triangles. Note that here we assign the albedo to each vertex, not each face as is commonly done in other rendering programs. When tracing, we then use linear interpolation to calculate the albedo at the intersect point based on the albedos of the vertices of the triangle we intersected.To use this class you must provide at minimum the
vertices
,albedos
, andfacets
, which result in thenormals
being computed for you. In addition, when initializing the class, you can provide (or have automatically computed) an axis aligned bounding box which contains all of the represented surface and a reference ellipsoid which describes the tri-axial ellipsoid which best represents the surface. Both of these are optional though.Once initialized, you can use this class for ray tracing as well as for identifying limbs and limb jacobians. That being said, you typically should accelerate these things using the
KDTree
class, which will result in much better performance.Note that beyond using double precision, this is identical to the
Triangle32
class.- Parameters:
vertices (ARRAY_LIKE) – The vertices for the surface as a n by 3 array
albedos (Union[ARRAY_LIKE, float]) – The albedo(s) for the surface as either a scalar or a length n array
facets (ARRAY_LIKE) – The connectivity map for the surface as a mxp array where m is the number of faces, p is the number of vertices for each face, and each element is an index into the
vertices
arraynormals (Optional[ARRAY_LIKE]) – The normal vectors for each face of the surface. If
None
then the normals will be computedcompute_bounding_box (Optional[AxisAlignedBoundingBox]) – A flag specifying whether to compute the axis aligned bounding box for the surface
bounding_box – The axis aligned bounding box for the surface. This will be overwritten if
compute_bounding_box
isTrue
compute_reference_ellipsoid (bool) – A flag specifying whether to compute the reference ellipsoid for the surface.
reference_ellipsoid (Optional[Ellipsoid]) – The reference ellipsoid for the surface. If
compute_reference_ellipsoid
isTrue
this will be overwritten
- bounding_box: AxisAlignedBoundingBox¶
The
AxisAlignedBoundingBox
that fully contains this solid.
- albedos¶
This property represents the albedo for the surface.
The albedo can either be a scalar, if there is a single albedo for the entire array, or an array of length n if there is a different albedo value for each vertex. Both are accessed through this property
- facets¶
This property returns the facets for the surfaces(s) as a mx3 ndarray where each face has 3 vertices and there are m faces overall.
The facet elements are indices into the
vertices
array. They must be positive.Each row of this array corresponds to the same row of the
normals
array
- normals¶
This property returns the normals for the surfaces(s) as a mx3 ndarray where there are m surfaces contained
Each row of this array corresponds to the same row in the
facets
array.
- num_faces¶
The number of faces in this surface.
This is the length of the first axis of the
facets
array.
- sides¶
This property calculates the primary sides of the surface as a mx3x2 ndarray where each surface has 2 primary sides and there are m surfaces overall
- Returns:
The primary sides of the surface
- Return type:
np.ndarray
- stacked_vertices¶
This property returns the vertices for the surfaces(s) as a mx3xp ndarray where each surface has p vertices and there are m surfaces overall.
This returns self.vertices[self.facets].swapaxes(-1, -2). Note that this will always produce a copy, so be cautious about using this property frequently
Summary of Methods
This method computes the bounding box that contains all of the vertices. |
|
This method computes the intersects between a single ray and the surface describe by this object. |
|
This method computes the linear change in the limb location given a change in the relative position between the surface and the observer. |
|
This method computes the unit normal vectors for each facet. |
|
This method computes the reference ellipsoid that best represents the vertices. |
|
This method determines the limb points for a surface (visible edge of the surface) that would be visible for an observer located at |
|
This method computes the albedo for a given intersect point and intersect face. |
|
This method is used to merge two surface collections together. |
|
This method rotates the surface into a new frame. |
|
This python method provides an easy interface to trace a number of Rays through the surface. |
|
This method translates the surface |