diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-03 11:24:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-03 11:24:31 +0400 |
commit | bb22b7c58083a45fca60f0c9e135a54714beed27 (patch) | |
tree | e29e676b5f3af88405c5acd3b403da4110151238 /source | |
parent | 1f21efdeac19d57b60554da920935a97d682b9b9 (diff) |
add dist_to_line_v3() for completeness, (had dist_to_line_v2 already)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 448396811d3..d475d476c6d 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -68,6 +68,7 @@ void closest_to_line_segment_v2(float closest[2], const float p[2], const float float dist_to_plane_normalized_v3(const float p[3], const float plane_co[3], const float plane_no_unit[3]); float dist_to_plane_v3(const float p[3], const float plane_co[3], const float plane_no[3]); float dist_to_line_segment_v3(const float p[3], const float l1[3], const float l2[3]); +float dist_to_line_v3(const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); float closest_to_line_v2(float r[2], const float p[2], const float l1[2], const float l2[2]); void closest_to_line_segment_v3(float r[3], const float p[3], const float l1[3], const float l2[3]); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 70a02544acf..e1dfe40cdf4 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -304,6 +304,15 @@ float dist_to_line_segment_v3(const float v1[3], const float v2[3], const float return len_v3v3(closest, v1); } +float dist_to_line_v3(const float v1[3], const float v2[3], const float v3[3]) +{ + float closest[3]; + + closest_to_line_v3(closest, v1, v2, v3); + + return len_v3v3(closest, v1); +} + /* Adapted from "Real-Time Collision Detection" by Christer Ericson, * published by Morgan Kaufmann Publishers, copyright 2005 Elsevier Inc. * |