[Bf-blender-cvs] [1dd17be] master: Knife tool: simplify hit-depth calculation

Campbell Barton noreply at git.blender.org
Sun Aug 17 04:53:28 CEST 2014


Commit: 1dd17bed4a7a322e6493914fee25ee9562e153ea
Author: Campbell Barton
Date:   Sun Aug 17 12:50:48 2014 +1000
Branches: master
https://developer.blender.org/rB1dd17bed4a7a322e6493914fee25ee9562e153ea

Knife tool: simplify hit-depth calculation

===================================================================

M	source/blender/blenlib/intern/math_vector_inline.c
M	source/blender/editors/mesh/editmesh_knife.c

===================================================================

diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 0a990e0..5529433 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -466,7 +466,7 @@ MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3])
 }
 
 /**
- * Has the effect of mul_m3_v3(), on a single axis.
+ * Has the effect of #mul_m3_v3(), on a single axis.
  */
 MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3])
 {
@@ -482,7 +482,8 @@ MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3])
 }
 
 /**
- * Almost like mul_m4_v3(), misses adding translation.
+ * Has the effect of #mul_mat3_m4_v3(), on a single axis.
+ * (no adding translation)
  */
 MINLINE float dot_m4_v3_row_x(float M[4][4], const float a[3])
 {
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 609f018..4182d0e 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1224,16 +1224,7 @@ static void clip_to_ortho_planes(float v1[3], float v2[3], float d)
 
 static void set_linehit_depth(KnifeTool_OpData *kcd, KnifeLineHit *lh)
 {
-	float vnear[3], vfar[3];
-
-	ED_view3d_win_to_segment(kcd->ar, kcd->vc.v3d, lh->schit, vnear, vfar, true);
-	mul_m4_v3(kcd->ob->imat, vnear);
-	if (kcd->is_ortho && (kcd->vc.rv3d->persp != RV3D_CAMOB)) {
-		if (kcd->ortho_extent == 0.0f)
-			calc_ortho_extent(kcd);
-		clip_to_ortho_planes(vnear, vfar, kcd->ortho_extent + 10.0f);
-	}
-	lh->m = len_v3v3(vnear, lh->cagehit);
+	lh->m = dot_m4_v3_row_z(kcd->vc.rv3d->persmatob, lh->cagehit);
 }
 
 /* Finds visible (or all, if cutting through) edges that intersects the current screen drag line */




More information about the Bf-blender-cvs mailing list