Knife tool: simplify hit-depth calculation

This commit is contained in:
2014-08-17 12:50:48 +10:00
parent bba80ed7af
commit 1dd17bed4a
2 changed files with 4 additions and 12 deletions

View File

@@ -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])
{

View File

@@ -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 */