*/
inline void barycentric_coords(const std::vector<const double*>& n, const double *p, double *bc)
{
- enum { _X, _Y, _Z };
+ enum { _XX=0, _YY, _ZZ };
switch(n.size())
{
case 2:
{ // TRIA3
// matrix 2x2
double
- T11 = n[0][_X]-n[2][_X], T12 = n[1][_X]-n[2][_X],
- T21 = n[0][_Y]-n[2][_Y], T22 = n[1][_Y]-n[2][_Y];
+ T11 = n[0][_XX]-n[2][_XX], T12 = n[1][_XX]-n[2][_XX],
+ T21 = n[0][_YY]-n[2][_YY], T22 = n[1][_YY]-n[2][_YY];
// matrix determinant
double Tdet = T11*T22 - T12*T21;
if ( (std::fabs( Tdet) ) < (std::numeric_limits<double>::min()) )
// matrix inverse
double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11;
// vector
- double r11 = p[_X]-n[2][_X], r12 = p[_Y]-n[2][_Y];
+ double r11 = p[_XX]-n[2][_XX], r12 = p[_YY]-n[2][_YY];
// barycentric coordinates: mutiply matrix by vector
bc[0] = (t11 * r11 + t12 * r12)/Tdet;
bc[1] = (t21 * r11 + t22 * r12)/Tdet;
// bc1*( z1 - z4 ) + bc2*( z2 - z4 ) + bc3*( z3 - z4 ) = px - z4
double T[3][4]=
- {{ n[0][_X]-n[3][_X], n[1][_X]-n[3][_X], n[2][_X]-n[3][_X], p[_X]-n[3][_X] },
- { n[0][_Y]-n[3][_Y], n[1][_Y]-n[3][_Y], n[2][_Y]-n[3][_Y], p[_Y]-n[3][_Y] },
- { n[0][_Z]-n[3][_Z], n[1][_Z]-n[3][_Z], n[2][_Z]-n[3][_Z], p[_Z]-n[3][_Z] }};
+ {{ n[0][_XX]-n[3][_XX], n[1][_XX]-n[3][_XX], n[2][_XX]-n[3][_XX], p[_XX]-n[3][_XX] },
+ { n[0][_YY]-n[3][_YY], n[1][_YY]-n[3][_YY], n[2][_YY]-n[3][_YY], p[_YY]-n[3][_YY] },
+ { n[0][_ZZ]-n[3][_ZZ], n[1][_ZZ]-n[3][_ZZ], n[2][_ZZ]-n[3][_ZZ], p[_ZZ]-n[3][_ZZ] }};
if ( !solveSystemOfEquations<3>( T, bc ) )
bc[0]=1., bc[1] = bc[2] = bc[3] = 0;
namespace INTERP_KERNEL
{
- enum { _X=0, _Y, _Z };
+ enum { _XX=0, _YY, _ZZ };
inline bool samePoint( const double* p1, const double* p2 )
{
const std::vector<double*> * pPolygonA = &triangle.getPolygonA();
if ( pPolygonA->size() < 3 )
{
- if ( !epsilonEqual( triNormal[_Z], 0 ))
+ if ( !epsilonEqual( triNormal[_ZZ], 0 ))
return; // not vertical triangle does not intersect the unit tetra
// Vertical triangle. Use inherited methods of TransformedTriangle to
}
// check if the segment p1-p2 is on the inclined side
if ( sideFaces[3] &&
- epsilonEqual( p1[_X] + p1[_Y] + p1[_Z], 1.0 ) &&
- epsilonEqual( p2[_X] + p2[_Y] + p2[_Z], 1.0 ))
+ epsilonEqual( p1[_XX] + p1[_YY] + p1[_ZZ], 1.0 ) &&
+ epsilonEqual( p2[_XX] + p2[_YY] + p2[_ZZ], 1.0 ))
{
sideFaces[3]->push_back( new double[3] );
copyVector3( p1, sideFaces[3]->back() );