diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-02-06 13:47:46 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-02-06 13:49:12 +0300 |
commit | 6202bc82b858d8f6876c6c20ec62dd0a16209087 (patch) | |
tree | 8a3e0bf4ef94fb91c6190c743d00a17aa77eb7dc /source/blender/blenlib/BLI_math_geom.h | |
parent | f7613cf41ceb4d31d8a869e27cef4781a83e09db (diff) |
Fix T60935: More numerically stable distance to ray computation
The old function was numerically very unstable for 2 reasons:
computing the square and then subtracting the results.
In the example in T60935 all precision was lost and it returned the distance 0
for all points.
I also removed the `depth` parameter since it wasn't used and computing
it would have made the code more complicated.
Reviewers: brecht, campbellbarton
Differential Revision: https://developer.blender.org/D4308
Diffstat (limited to 'source/blender/blenlib/BLI_math_geom.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index a564e5481b9..54a4a38b15e 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -109,9 +109,9 @@ float dist_signed_squared_to_corner_v3v3v3( const float p[3], const float v1[3], const float v2[3], const float v3[3], const float axis_ref[3]); -float dist_squared_to_ray_v3( +float dist_squared_to_ray_v3_normalized( const float ray_origin[3], const float ray_direction[3], - const float co[3], float *r_depth); + const float co[3]); float dist_squared_ray_to_seg_v3( const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], |