diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2016-01-25 10:17:45 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-25 11:01:42 +0300 |
commit | bfabb9d3c5057a5eb5796ba8457990a80e1a74e5 (patch) | |
tree | cf0c98b96975b17f91ecde4ead5dca9faa2b67da /source/blender/blenlib/BLI_math_geom.h | |
parent | fea44edeeaea6bcb2ce710d4367e7ca2cbe9b263 (diff) |
Math Lib: Add dist_squared_ray_to_aabb_v3 utility
Diffstat (limited to 'source/blender/blenlib/BLI_math_geom.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 06412835936..dff4c68d4b9 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -284,6 +284,23 @@ bool isect_ray_aabb_v3( const struct IsectRayAABB_Precalc *data, const float bb_min[3], const float bb_max[3], float *tmin); +struct NearestRayToAABB_Precalc { + float ray_origin[3]; + float ray_dot_axis[3]; + float idot_axis[3]; + float cdot_axis[3]; + float idiag_sq[3]; + bool sign[3]; +}; + +void dist_squared_ray_to_aabb_v3_precalc( + struct NearestRayToAABB_Precalc *data, + const float ray_origin[3], const float ray_direction[3]); +float dist_squared_ray_to_aabb_v3( + const struct NearestRayToAABB_Precalc *data, + const float bb_min[3], const float bb_max[3], + bool r_axis_closest[3]); + /* other */ bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float ipoint[3]); |