ray_march_util

Short description

@author: Moritz F P Becker

pyrid.geometry.ray_march_util.nearest_triangle(pos, System)[source]

Updates a position vector to the plane of the nearest triangle.

Parameters
posfloat64[3]

position vector

Systemobject

Instance of System class

Returns
int64

Triangle id of the closest triangle.

pyrid.geometry.ray_march_util.ray_march_surface(pos, quaternion, dX, triangle_id, System, update_quat=False)[source]

Ray marches a direction vector across the surface of a triangulated mesh.

Parameters
posfloat64[3]

Position vector

quaternionfloat64[4]

Rotation quaternion

dXfloat64[3]

Direction vector

triangle_idint64

Triangle id

Systemobject

Instance of System class

Returns
int64

Index of the triangle the direction vector ended up on.

pyrid.geometry.ray_march_util.ray_march_volume(pos, dX, System)[source]

Ray marches along a direction vector and tests and resolves triangle collisions. The algorithm is based on [5] : Amanatides et al. 1987 “A Fast Voxel Traversal Algorithm for Ray Tracing” Also see [6] : Ericson “Real-Time Collision Detection”, chapter 7.4.2 and 7.7

Parameters
posfloat64[3]

Position vector

dXfloat64[3]

Direction vector

Systemobject

Instance of System class

Returns
boolean

True if ray marching was successfull, False if absorptive boundary has been hit.

See also

ray_mesh_intersection_test
pyrid.geometry.ray_march_util.update_to_nearest_triangle(pos, quaternion, triangle_id, System)[source]

Updates a position vector to the plane of the nearest triangle.

Parameters
posfloat64[3]

Position vector

quaternionfloat64[4]

Quaternion vector

triangle_idint64

Triangle id

Systemobject

Instance of System class

Returns
int64

Triangle id of the closest triangle.