diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-12-12 00:27:39 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2010-12-12 00:27:39 +0300 |
commit | 448d24e7a02b3ebf3b5a66f64d187b9cd64ed9ed (patch) | |
tree | 2e7a2532ccbb4d34956a59052970dfb0b0b2ed7d /source/blender/blenlib/intern/math_vector.c | |
parent | 194449d03801d4c41df2a54e5564c67888ecf3d2 (diff) |
New math util funcitons:
- equals_v2v2
- project_v2_v2v2
- isect_seg_seg_v2_point
which would be necessery for my further multires interpolation commit
M_Geometry_LineIntersect2D now uses isect_seg_seg_v2_point(). Behaviour of this
function was changed a bit -- it haven't returned intersection point in several
cases when two segments are making angle.
Diffstat (limited to 'source/blender/blenlib/intern/math_vector.c')
-rw-r--r-- | source/blender/blenlib/intern/math_vector.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 35476a8aba9..6ac1fcfab7e 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -231,6 +231,16 @@ void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const /********************************* Geometry **********************************/ /* Project v1 on v2 */ +void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]) +{ + float mul; + mul = dot_v2v2(v1, v2) / dot_v2v2(v2, v2); + + c[0] = mul * v2[0]; + c[1] = mul * v2[1]; +} + +/* Project v1 on v2 */ void project_v3_v3v3(float c[3], const float v1[3], const float v2[3]) { float mul; |