Surface32

giant.ray_tracer.shapes.surface:

class giant.ray_tracer.shapes.surface.Surface32(self, vertices, albedos, facets, normals=None, compute_bounding_box=True, bounding_box=None, compute_reference_ellipsoid=True, reference_ellipsoid=None)

This class serves as the backbone for surfaces in GIANT represented using single precision.

As such it provides the default __init__(), __reduce__(), __eq__(), merge(), rotate(), translate(), compute_bounding_box(), and compute_reference_ellipsoid() methods which are generally shared by all surfaces. It additionally provides properties facets, albedos, vertices, normals, stacked_vertices, and num_faces which are commonly shared.

You should only use this class when developing a new surface in GIANT using single precision vertices. Beyond that this shouldn’t even be used as an instance check. For an example of how to implement a new surface, examine the Triangle32 class code. If you want to develop a new surface using single precision vertices then look at the Surface32 and Triangle32 classes. Though you can technically initialize an instance of this class, there’s not real reason to since the tracing interface is undefined making the instance mostly worthless.

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 array

  • normals (Optional[ARRAY_LIKE]) – The normal vectors for each face of the surface. If None then the normals will be computed

  • compute_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 is True

  • 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 is True this will be overwritten

bounding_box: AxisAlignedBoundingBox

The AxisAlignedBoundingBox that fully contains this solid.

reference_ellipsoid: Ellipsoid

The Ellipsoid that best represents the surface.

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 mxp ndarray where each face has p 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.

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

vertices

This property returns the vertices for the surfaces as a nx3 ndarray where there are n vertices.

The facets array indexes into the row axis of this array

Summary of Methods

compute_bounding_box

This method computes the bounding box that contains all of the vertices.

compute_intersect

This method computes the intersects between a single ray and the surface describe by this object.

compute_limb_jacobian

This method computes the linear change in the limb location given a change in the relative position between the surface and the observer.

compute_reference_ellipsoid

This method computes the reference ellipsoid that best represents the vertices.

find_limbs

This method determines the limb points for a surface (visible edge of the surface) that would be visible for an observer located at observer_position looking toward scan_center_dir along the directions given by scan_dirs.

merge

This method is used to merge two surface collections together.

rotate

This method rotates the surface into a new frame.

trace

This python method provides an easy interface to trace a number of Rays through the surface.

translate

This method translates the surface