diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-01-06 12:32:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-01-06 12:32:25 +0300 |
commit | 28e689b9aa0f716fa021a3185cb446a2fa69ec59 (patch) | |
tree | 9772fb477057e70af31c37abb4c4a51037ef3699 /source/blender/blenlib/intern | |
parent | 3ecacb56544a26738c9581ac8c082c0101d64ba4 (diff) |
bugfix [#25498] Projection paint clone tool leaves seams
Diffstat (limited to 'source/blender/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 605f3ad785e..2a420b78fda 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1030,7 +1030,7 @@ int isect_aabb_aabb_v3(float min1[3], float max1[3], float min2[3], float max2[3 /* find closest point to p on line through l1,l2 and return lambda, * where (0 <= lambda <= 1) when cp is in the line segement l1,l2 */ -float closest_to_line_v3(float cp[3],float p[3], float l1[3], float l2[3]) +float closest_to_line_v3(float cp[3], const float p[3], const float l1[3], const float l2[3]) { float h[3],u[3],lambda; sub_v3_v3v3(u, l2, l1); @@ -1042,6 +1042,17 @@ float closest_to_line_v3(float cp[3],float p[3], float l1[3], float l2[3]) return lambda; } +float closest_to_line_v2(float cp[2],const float p[2], const float l1[2], const float l2[2]) +{ + float h[2],u[2],lambda; + sub_v2_v2v2(u, l2, l1); + sub_v2_v2v2(h, p, l1); + lambda =dot_v2v2(u,h)/dot_v2v2(u,u); + cp[0] = l1[0] + u[0] * lambda; + cp[1] = l1[1] + u[1] * lambda; + return lambda; +} + #if 0 /* little sister we only need to know lambda */ static float lambda_cp_line(float p[3], float l1[3], float l2[3]) |