Revision: 48669
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48669
Author: psy-fi
Date: 2012-07-06 01:39:27 +0000 (Fri, 06 Jul 2012)
Log Message:
-----------
Utility function, project point along vector to plane. will be needed
for uv transform correction.
Modified Paths:
--------------
branches/soc-2012-bratwurst/source/blender/blenlib/BLI_math_vector.h
branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c
Modified: branches/soc-2012-bratwurst/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenlib/BLI_math_vector.h
2012-07-06 00:33:09 UTC (rev 48668)
+++ branches/soc-2012-bratwurst/source/blender/blenlib/BLI_math_vector.h
2012-07-06 01:39:27 UTC (rev 48669)
@@ -203,6 +203,7 @@
void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]);
void project_v3_v3v3(float r[3], const float p[3], const float n[3]);
void project_v3_plane(float v[3], const float n[3], const float p[3]);
+void project_v3_v3_plane(float v[3], const float v2[3], const float n[3],
const float p[3]);
void reflect_v3_v3v3(float r[3], const float v[3], const float n[3]);
void ortho_basis_v3v3_v3(float r1[3], float r2[3], const float a[3]);
void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const
float c[3]);
Modified:
branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c
===================================================================
--- branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c
2012-07-06 00:33:09 UTC (rev 48668)
+++ branches/soc-2012-bratwurst/source/blender/blenlib/intern/math_vector.c
2012-07-06 01:39:27 UTC (rev 48669)
@@ -338,6 +338,20 @@
sub_v3_v3(v, vector);
}
+/* project vector along the direction of v2 on a plane defined by normal and a
plane point p */
+void project_v3_v3_plane(float v[3], const float v2[3], const float n[3],
const float p[3])
+{
+ float vector[3];
+ float mul;
+
+ sub_v3_v3v3(vector, v, p);
+ mul = dot_v3v3(vector, n)/dot_v3v3(v2, n);
+
+ mul_v3_v3fl(vector, v2, mul);
+ sub_v3_v3(v, vector);
+}
+
+
/* Returns a vector bisecting the angle at v2 formed by v1, v2 and v3 */
void bisect_v3_v3v3v3(float out[3], const float v1[3], const float v2[3],
const float v3[3])
{
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs