changed call to InterpolationParameters...

This commit is contained in:
Nico Pietroni 2010-05-31 10:12:31 +00:00
parent 066bc0b7cf
commit cf60111b79
1 changed files with 96 additions and 87 deletions

View File

@ -251,94 +251,103 @@ bool InterpolationParameters2(const Point2<ScalarType> &V1,
@return true se bq appartiene alla faccia, false altrimenti @return true se bq appartiene alla faccia, false altrimenti
*/ */
template<class TriangleType, class ScalarType> template<class TriangleType, class ScalarType>
bool InterpolationParameters(const TriangleType t,const Point3<ScalarType> & bq, ScalarType &a, ScalarType &b, ScalarType &_c ) bool InterpolationParameters(const TriangleType t,const Point3<ScalarType> & N,const Point3<ScalarType> & bq, ScalarType &a, ScalarType &b, ScalarType &c )
{ {
const ScalarType _EPSILON = ScalarType(0.000001); Point3<ScalarType> bary;
#define x1 (t.P(0).X()) bool done= InterpolationParameters(t,N,bq,bary);
#define y1 (t.P(0).Y()) a=bary[0];
#define z1 (t.P(0).Z()) b=bary[1];
#define x2 (t.P(1).X()) c=bary[2];
#define y2 (t.P(1).Y()) return done;
#define z2 (t.P(1).Z()) // else if(fp->Flags() & FaceType::NORMY ) axis = 1;
#define x3 (t.P(2).X()) // else axis =2;
#define y3 (t.P(2).Y()) // InterpolationParameters(*fp,axis,Point,Bary);
#define z3 (t.P(2).Z()) //const ScalarType _EPSILON = ScalarType(0.000001);
#define px (bq[0]) //#define x1 (t.P(0).X())
#define py (bq[1]) //#define y1 (t.P(0).Y())
#define pz (bq[2]) //#define z1 (t.P(0).Z())
//#define x2 (t.P(1).X())
ScalarType t1 = px*y2; //#define y2 (t.P(1).Y())
ScalarType t2 = px*y3; //#define z2 (t.P(1).Z())
ScalarType t3 = py*x2; //#define x3 (t.P(2).X())
ScalarType t4 = py*x3; //#define y3 (t.P(2).Y())
ScalarType t5 = x2*y3; //#define z3 (t.P(2).Z())
ScalarType t6 = x3*y2; //#define px (bq[0])
ScalarType t8 = x1*y2; //#define py (bq[1])
ScalarType t9 = x1*y3; //#define pz (bq[2])
ScalarType t10 = y1*x2; //
ScalarType t11 = y1*x3; // ScalarType t1 = px*y2;
ScalarType t13 = t8-t9-t10+t11+t5-t6; // ScalarType t2 = px*y3;
if(fabs(t13)>=_EPSILON) // ScalarType t3 = py*x2;
{ // ScalarType t4 = py*x3;
ScalarType t15 = px*y1; // ScalarType t5 = x2*y3;
ScalarType t16 = py*x1; // ScalarType t6 = x3*y2;
a = (t1 -t2-t3 +t4+t5-t6 )/t13; // ScalarType t8 = x1*y2;
b = -(t15-t2-t16+t4+t9-t11)/t13; // ScalarType t9 = x1*y3;
_c = (t15-t1-t16+t3+t8-t10)/t13; // ScalarType t10 = y1*x2;
return true; // ScalarType t11 = y1*x3;
} // ScalarType t13 = t8-t9-t10+t11+t5-t6;
// if(fabs(t13)>=_EPSILON)
t1 = px*z2; // {
t2 = px*z3; // ScalarType t15 = px*y1;
t3 = pz*x2; // ScalarType t16 = py*x1;
t4 = pz*x3; // a = (t1 -t2-t3 +t4+t5-t6 )/t13;
t5 = x2*z3; // b = -(t15-t2-t16+t4+t9-t11)/t13;
t6 = x3*z2; // _c = (t15-t1-t16+t3+t8-t10)/t13;
t8 = x1*z2; // return true;
t9 = x1*z3; // }
t10 = z1*x2; //
t11 = z1*x3; // t1 = px*z2;
t13 = t8-t9-t10+t11+t5-t6; // t2 = px*z3;
if(fabs(t13)>=_EPSILON) // t3 = pz*x2;
{ // t4 = pz*x3;
ScalarType t15 = px*z1; // t5 = x2*z3;
ScalarType t16 = pz*x1; // t6 = x3*z2;
a = (t1 -t2-t3 +t4+t5-t6 )/t13; // t8 = x1*z2;
b = -(t15-t2-t16+t4+t9-t11)/t13; // t9 = x1*z3;
_c = (t15-t1-t16+t3+t8-t10)/t13; // t10 = z1*x2;
return true; // t11 = z1*x3;
} // t13 = t8-t9-t10+t11+t5-t6;
// if(fabs(t13)>=_EPSILON)
t1 = pz*y2; t2 = pz*y3; // {
t3 = py*z2; t4 = py*z3; // ScalarType t15 = px*z1;
t5 = z2*y3; t6 = z3*y2; // ScalarType t16 = pz*x1;
t8 = z1*y2; t9 = z1*y3; // a = (t1 -t2-t3 +t4+t5-t6 )/t13;
t10 = y1*z2; t11 = y1*z3; // b = -(t15-t2-t16+t4+t9-t11)/t13;
t13 = t8-t9-t10+t11+t5-t6; // _c = (t15-t1-t16+t3+t8-t10)/t13;
if(fabs(t13)>=_EPSILON) // return true;
{ // }
ScalarType t15 = pz*y1; //
ScalarType t16 = py*z1; // t1 = pz*y2; t2 = pz*y3;
a = (t1 -t2-t3 +t4+t5-t6 )/t13; // t3 = py*z2; t4 = py*z3;
b = -(t15-t2-t16+t4+t9-t11)/t13; // t5 = z2*y3; t6 = z3*y2;
_c = (t15-t1-t16+t3+t8-t10)/t13; // t8 = z1*y2; t9 = z1*y3;
return true; // t10 = y1*z2; t11 = y1*z3;
} // t13 = t8-t9-t10+t11+t5-t6;
// if(fabs(t13)>=_EPSILON)
#undef x1 // {
#undef y1 // ScalarType t15 = pz*y1;
#undef z1 // ScalarType t16 = py*z1;
#undef x2 // a = (t1 -t2-t3 +t4+t5-t6 )/t13;
#undef y2 // b = -(t15-t2-t16+t4+t9-t11)/t13;
#undef z2 // _c = (t15-t1-t16+t3+t8-t10)/t13;
#undef x3 // return true;
#undef y3 // }
#undef z3 //
#undef px //#undef x1
#undef py //#undef y1
#undef pz //#undef z1
//#undef x2
return false; //#undef y2
//#undef z2
//#undef x3
//#undef y3
//#undef z3
//#undef px
//#undef py
//#undef pz
//
// return false;
} }