[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36760] trunk/blender/source/blender/ blenlib: correct some comments in last commit.

Campbell Barton ideasman42 at gmail.com
Thu May 19 05:59:52 CEST 2011


Revision: 36760
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36760
Author:   campbellbarton
Date:     2011-05-19 03:59:52 +0000 (Thu, 19 May 2011)
Log Message:
-----------
correct some comments in last commit.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_math_geom.h
    trunk/blender/source/blender/blenlib/intern/math_geom.c

Modified: trunk/blender/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_geom.h	2011-05-19 03:49:57 UTC (rev 36759)
+++ trunk/blender/source/blender/blenlib/BLI_math_geom.h	2011-05-19 03:59:52 UTC (rev 36760)
@@ -97,7 +97,7 @@
 					   float v1[3], float v2[3], float *lambda, int clip);
 
 /**
- * Definition of a callback routine that receives events.
+ * Intersect line/plane, optionally treat line as directional (like a ray) with the no_flip argument.
  * @param out The intersection point.
  * @param l1 The first point of the line.
  * @param l2 The second point of the line.

Modified: trunk/blender/source/blender/blenlib/intern/math_geom.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom.c	2011-05-19 03:49:57 UTC (rev 36759)
+++ trunk/blender/source/blender/blenlib/intern/math_geom.c	2011-05-19 03:59:52 UTC (rev 36760)
@@ -642,8 +642,8 @@
 
 int isect_line_plane_v3(float out[3], const float l1[3], const float l2[3], const float plane_co[3], const float plane_no[3], const short no_flip)
 {
-	float l_vec[3]; /* line vector */
-	float p_no[3];
+	float l_vec[3]; /* l1 -> l2 normalized vector */
+	float p_no[3]; /* 'plane_no' normalized */
 	float dot;
 
 	sub_v3_v3v3(l_vec, l2, l1);
@@ -651,15 +651,16 @@
 	normalize_v3(l_vec);
 	normalize_v3_v3(p_no, plane_no);
 
-	/* for pradictable flipping */
 	dot= dot_v3v3(l_vec, p_no);
 	if(dot == 0.0f) {
 		return 0;
 	}
 	else {
-		float l1_plane[3]; /* line point aligne with the plane */
-		float dist;
+		float l1_plane[3]; /* line point aligned with the plane */
+		float dist; /* 'plane_no' aligned distance to the 'plane_co' */
 
+		/* for pradictable flipping since the plane is only used to
+		 * define a direction, ignore its flipping and aligned with 'l_vec' */
 		if(dot < 0.0f) {
 			dot= -dot;
 			negate_v3(p_no);
@@ -668,6 +669,8 @@
 		add_v3_v3v3(l1_plane, l1, p_no);
 
 		dist = lambda_cp_line(plane_co, l1, l1_plane);
+
+		/* treat line like a ray, when 'no_flip' is set */
 		if(no_flip && dist < 0.0f) {
 			dist= -dist;
 		}




More information about the Bf-blender-cvs mailing list