Module spherical_cow::util [] [src]

Useful helper functions such as a fast ray casting method and volume finder for use with arbitrary shaped triangular meshes.

Functions

ray_intersection_count

Find the baycentric coordinates (u,v) and distance t given three triangle veriticies vert0, vert1, vert2 and the unit vector dir (D) in the direction of a ray R(t) = O + tD such that R(t) is equivalent to a point T(u,v) on triangle T. Here, T(u,v) = (1-u-v)V_0+uV_1+uV_2. If distance t is less than the distance of our sphere from the origin (sphere_dist), then add one to the count.

trimesh_volume

Identify the volume of a trimesh which contains the cartesian origin (0, 0, 0). Consider the tetrahedron created by any triangle and the origin OABC and sum thier volumes.