HalfSpace¶
- class rubin_sim.utils.HalfSpace(vector, length)¶
Bases:
object
HalfSpaces are circles on the unit sphere defined by intersecting a plane with the unit sphere. They are specified by the unit vector pointing to their center on the unit sphere and the distance from the center of the unit sphere to the plane along that unit vector.
See Section 3.1 of
Szalay A. et al. (2007) “Indexing the Sphere with the Hierarchical Triangular Mesh” arXiv:cs/0701164
Note that the specifying distance can be negative. In this case, the halfspace is defined as the larger of the two regions on the unit sphere divided by the circle where the plane of the halfspace intersects the unit sphere.
Attributes Summary
The distance along the Half Space's vector that defines the extent of the Half Space.
The angular radius of the Half Space on the surface of the sphere in radians.
The unit vector from the origin to the center of the Half Space.
Methods Summary
contains_many_pts
(pts)- Parameters:
contains_pt
(pt[, tol])pt is a cartesian point (not necessarily on the unit sphere).
contains_trixel
(tx)tx is a Trixel.
find_all_trixels
(level)Find the HTMIDs of all of the trixels filling the half space
tx is a Trixel.
intersects_circle
(center, radius_rad)Does this Half Space intersect a circle on the unit sphere
intersects_edge
(pt1, pt2)pt1 and pt2 are two unit vectors; the edge goes from pt1 to pt2.
join_trixel_bound_sets
(b1, b2)Take two sets of trixel bounds as returned by HalfSpace.find_all_trixels and return a set of trixel bounds that represents the intersection of the original sets of bounds
merge_trixel_bounds
(bounds)Take a list of trixel bounds as returned by HalfSpace.find_all_trixels and merge any tuples that should be merged
Attributes Documentation
- dd¶
The distance along the Half Space’s vector that defines the extent of the Half Space.
- phi¶
The angular radius of the Half Space on the surface of the sphere in radians.
- vector¶
The unit vector from the origin to the center of the Half Space.
Methods Documentation
- contains_many_pts(pts)¶
- Parameters:
- pts is a numpy array in which each row is a point on the
- unit sphere (note: must be normalized)
- Returns:
- numpy array of booleans indicating which of pts are contained
- by this HalfSpace
- contains_pt(pt, tol=None)¶
pt is a cartesian point (not necessarily on the unit sphere). The method returns True if the projection of that point onto the unit sphere is contained in the halfspace; False otherwise.
- contains_trixel(tx)¶
tx is a Trixel.
Return “full” if the Trixel is fully contained by this halfspace.
Return “partial” if the Trixel is only partially contained by this halfspace
Return “outside” if no part of the Trixel is contained by this halfspace.
See section 4.1 of
Szalay A. et al. (2007) “Indexing the Sphere with the Hierarchical Triangular Mesh” arXiv:cs/0701164
- find_all_trixels(level)¶
Find the HTMIDs of all of the trixels filling the half space
- Parameters:
- level is an integer denoting the resolution of the trixel grid
- Returns:
- A list of tuples. Each tuple gives an inclusive range of HTMIDs
- corresponding to trixels within the HalfSpace
- intersects_bounding_circle(tx)¶
tx is a Trixel. Return True if this halfspace intersects the bounding circle of the trixel; False otherwise.
See the discussion around equation 4.2 of
Szalay A. et al. (2007) “Indexing the Sphere with the Hierarchical Triangular Mesh” arXiv:cs/0701164
- intersects_circle(center, radius_rad)¶
Does this Half Space intersect a circle on the unit sphere
center is the unit vector pointing to the center of the circle
radius_rad is the radius of the circle in radians
Returns a
bool
- intersects_edge(pt1, pt2)¶
pt1 and pt2 are two unit vectors; the edge goes from pt1 to pt2. Return True if the edge intersects this halfspace; False otherwise.
see equation 4.8 of
Szalay A. et al. (2007) “Indexing the Sphere with the Hierarchical Triangular Mesh” arXiv:cs/0701164
- static join_trixel_bound_sets(b1, b2)¶
Take two sets of trixel bounds as returned by HalfSpace.find_all_trixels and return a set of trixel bounds that represents the intersection of the original sets of bounds
- static merge_trixel_bounds(bounds)¶
Take a list of trixel bounds as returned by HalfSpace.find_all_trixels and merge any tuples that should be merged
- Parameters:
- bounds is a list of trixel bounds as returned by HalfSpace.find_all_trixels
- Returns:
- A new, equivalent list of trixel bounds