triro 1.3.0
A Python Ray-Mesh Intersector in OptiX
|
A class for performing ray-mesh intersection tests using OptiX acceleration structure. More...
Public Member Functions | |
__init__ (self, **kwargs) | |
Initialize the RayMeshIntersector class. | |
update_raw (self, Float32[torch.Tensor, "n 3"] vertices, Int32[torch.Tensor, "f 3"] faces) | |
Update the raw mesh data. | |
Bool[torch.Tensor, "*b"] | intersects_any (self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions) |
Check if any intersections occur for each ray. | |
Int32[torch.Tensor, "*b"] | intersects_first (self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions) |
Find the index of the first intersection for each ray. | |
Tuple[ Float32[torch.Tensor, "h 3"], Int32[torch.Tensor, "h"], Int32[torch.Tensor, "h"]] | intersects_location (self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions) |
Find the intersection location for each ray. | |
Int32[torch.Tensor, "*b 3"] | intersects_count (self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions) |
Count the number of intersections for each ray. | |
( Tuple[ Int32[torch.Tensor, "h"], # hit triangle indices Int32[torch.Tensor, "h"], # ray indices Float32[torch.Tensor, "h 3"], # hit location]|Tuple[ Int32[torch.Tensor, "h"], Int32[torch.Tensor, "h"]] # hit triangle indices and ray indices) | intersects_id (self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions, bool return_locations=False, bool multiple_hits=True) |
Find the intersection indices for each ray. | |
Bool[torch.Tensor, "*b 3"] | contains_points (self, Float32[torch.Tensor, "*b 3"] points, Optional[Float32[torch.Tensor, "3"]] check_direction=None) |
Check if the points are contained within the mesh. | |
Public Attributes | |
( Tuple | intersects_closest [ Bool[torch.Tensor, "*b"], # hit Bool[torch.Tensor, "*b"], # front Int32[torch.Tensor, "*b"], # triangle index Float32[torch.Tensor, "*b 3"], # intersect location Float32[torch.Tensor, "*b 2"], # uv]|Tuple[ Bool[torch.Tensor, "*b"], # hit Bool[torch.Tensor, "h"], # front Int32[torch.Tensor, "h"], # ray index Int32[torch.Tensor, "h"], # triangle index Float32[torch.Tensor, "h 3"], # intersect location Float32[torch.Tensor, "h 2"], # uv:])(self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions, bool stream_compaction=False) |
Find the closest intersection for each ray. | |
mesh_vertices | |
mesh_faces | |
mesh_aabb | |
as_wrapper | |
A class for performing ray-mesh intersection tests using OptiX acceleration structure.
This class provides methods for checking if rays intersect with a mesh, finding the closest intersection, retrieving intersection locations, counting intersections, and more.
This class has similar functionality as the RayMeshIntersector
class in trimesh.ray
.
kwargs | Keyword arguments for initializing the intersector. Either 'mesh' or 'vertices' and 'faces' must be provided. |
Definition at line 18 of file ray_optix.py.
triro.ray.ray_optix.RayMeshIntersector.__init__ | ( | self, | |
** | kwargs | ||
) |
Initialize the RayMeshIntersector class.
kwargs | Keyword arguments for initializing the intersector. Either 'mesh' or 'vertices' and 'faces' must be provided. |
Definition at line 24 of file ray_optix.py.
Bool[torch.Tensor, "*b 3"] triro.ray.ray_optix.RayMeshIntersector.contains_points | ( | self, | |
Float32[torch.Tensor, "*b 3"] | points, | ||
Optional[Float32[torch.Tensor, "3"]] | check_direction = None |
||
) |
Check if the points are contained within the mesh.
points | (Float32[torch.Tensor, "*b 3"]): The points to check. |
check_direction | (Optional[Float32[torch.Tensor, "3"]], optional): The direction to check. Defaults to None. |
Definition at line 231 of file ray_optix.py.
Bool[torch.Tensor, "*b"] triro.ray.ray_optix.RayMeshIntersector.intersects_any | ( | self, | |
Float32[torch.Tensor, "*b 3"] | origins, | ||
Float32[torch.Tensor, "*b 3"] | directions | ||
) |
Check if any intersections occur for each ray.
origins | (Float32[torch.Tensor, "*b 3"]): The origins of the rays. |
directions | (Float32[torch.Tensor, "*b 3"]): The directions of the rays. |
Definition at line 77 of file ray_optix.py.
Int32[torch.Tensor, "*b 3"] triro.ray.ray_optix.RayMeshIntersector.intersects_count | ( | self, | |
Float32[torch.Tensor, "*b 3"] | origins, | ||
Float32[torch.Tensor, "*b 3"] | directions | ||
) |
Count the number of intersections for each ray.
origins | (Float32[torch.Tensor, "*b 3"]): The origins of the rays. |
directions | (Float32[torch.Tensor, "*b 3"]): The directions of the rays. |
Definition at line 172 of file ray_optix.py.
Int32[torch.Tensor, "*b"] triro.ray.ray_optix.RayMeshIntersector.intersects_first | ( | self, | |
Float32[torch.Tensor, "*b 3"] | origins, | ||
Float32[torch.Tensor, "*b 3"] | directions | ||
) |
Find the index of the first intersection for each ray.
origins | (Float32[torch.Tensor, "*b 3"]): The origins of the rays. |
directions | (Float32[torch.Tensor, "*b 3"]): The directions of the rays. |
Definition at line 90 of file ray_optix.py.
( Tuple[ Int32[torch.Tensor, "h"], # hit triangle indices Int32[torch.Tensor, "h"], # ray indices Float32[torch.Tensor, "h 3"], # hit location ] | Tuple[ Int32[torch.Tensor, "h"], Int32[torch.Tensor, "h"] ] # hit triangle indices and ray indices ) triro.ray.ray_optix.RayMeshIntersector.intersects_id | ( | self, | |
Float32[torch.Tensor, "*b 3"] | origins, | ||
Float32[torch.Tensor, "*b 3"] | directions, | ||
bool | return_locations = False , |
||
bool | multiple_hits = True |
||
) |
Find the intersection indices for each ray.
origins | (Float32[torch.Tensor, "*b 3"]): The origins of the rays. |
directions | (Float32[torch.Tensor, "*b 3"]): The directions of the rays. |
return_locations | (bool, optional): Whether to return the intersection locations. Defaults to False. |
multiple_hits | (bool, optional): Whether to allow multiple intersections per ray. Defaults to True. |
return_locations
is set to True) Definition at line 191 of file ray_optix.py.
Tuple[ Float32[torch.Tensor, "h 3"], Int32[torch.Tensor, "h"], Int32[torch.Tensor, "h"] ] triro.ray.ray_optix.RayMeshIntersector.intersects_location | ( | self, | |
Float32[torch.Tensor, "*b 3"] | origins, | ||
Float32[torch.Tensor, "*b 3"] | directions | ||
) |
Find the intersection location for each ray.
origins | (Float32[torch.Tensor, "*b 3"]): The origins of the rays. |
directions | (Float32[torch.Tensor, "*b 3"]): The directions of the rays. |
Definition at line 157 of file ray_optix.py.
triro.ray.ray_optix.RayMeshIntersector.update_raw | ( | self, | |
Float32[torch.Tensor, "n 3"] | vertices, | ||
Int32[torch.Tensor, "f 3"] | faces | ||
) |
Update the raw mesh data.
vertices | (Float32[torch.Tensor, "n 3"]): The vertices of the mesh. |
faces | (Int32[torch.Tensor, "f 3"]): The faces of the mesh. |
Definition at line 55 of file ray_optix.py.
triro.ray.ray_optix.RayMeshIntersector.as_wrapper |
Definition at line 48 of file ray_optix.py.
( Tuple triro.ray.ray_optix.RayMeshIntersector.intersects_closest[ Bool[torch.Tensor, "*b"], # hit Bool[torch.Tensor, "*b"], # front Int32[torch.Tensor, "*b"], # triangle index Float32[torch.Tensor, "*b 3"], # intersect location Float32[torch.Tensor, "*b 2"], # uv ] | Tuple[ Bool[torch.Tensor, "*b"], # hit Bool[torch.Tensor, "h"], # front Int32[torch.Tensor, "h"], # ray index Int32[torch.Tensor, "h"], # triangle index Float32[torch.Tensor, "h 3"], # intersect location Float32[torch.Tensor, "h 2"], # uv: ] )(self, Float32[torch.Tensor, "*b 3"] origins, Float32[torch.Tensor, "*b 3"] directions, bool stream_compaction=False) |
Find the closest intersection for each ray.
origins | (Float32[torch.Tensor, "*b 3"]): The origins of the rays. |
directions | (Float32[torch.Tensor, "*b 3"]): The directions of the rays. |
stream_compaction | (bool, optional): Whether to perform stream compaction. Defaults to False. |
stream_compaction
is False:stream_compaction
is True:Definition at line 117 of file ray_optix.py.
triro.ray.ray_optix.RayMeshIntersector.mesh_aabb |
Definition at line 43 of file ray_optix.py.
triro.ray.ray_optix.RayMeshIntersector.mesh_faces |
Definition at line 31 of file ray_optix.py.
triro.ray.ray_optix.RayMeshIntersector.mesh_vertices |
Definition at line 29 of file ray_optix.py.