/// PUBLIC INTERFACE METHODS //////////////
/////////////////////////////////////////////////////////////////////////////////////////
- /*
+ /**
* Constructor
* Create the TetraAffineTransform object from the tetrahedron
* with corners specified in pts. If the tetrahedron is degenerate or almost degenerate,
#endif
}
- /*
+ /**
* Calculates the transform of point srcPt and stores the result in destPt.
* If destPt == srcPt, then srcPt is overwritten safely.
*
}
}
- /*
+ /**
* Gives the determinant of the linear part of the transform
*
* @return determinant of the transform
return _determinant;
}
- /*
+ /**
* Outputs to std::cout the matrix A and the vector b
* of the transform Ax + b
*
/// PRIVATE METHODS //////////////
/////////////////////////////////////////////////////////////////////////////////////////
- /*
+ /**
* Calculates the inverse of the matrix A, stored in _linearTransform
* by LU-factorization and substitution
*
}
}
- /*
+ /**
* Updates the member _determinant of the matrix A of the transformation.
*
*/
_determinant = _linearTransform[0] * subDet[0] - _linearTransform[1] * subDet[1] + _linearTransform[2] * subDet[2];
}
- /*
+ /**
* Calculates the LU-factorization of the matrix A (_linearTransform)
* and stores it in lu. Since partial pivoting is used, there are
* row swaps. This is represented by the index permutation vector idx : to access element
}
}
- /*
+ /**
* Solves the system Lx = b, where L is lower unit-triangular (ones on the diagonal)
*
* @param x double[3] in which the solution is stored
{
// divisions are not carried out explicitly because lu does not store
// the diagonal values of L, which are all 1
- x[idx[0]] = ( b[idx[0]] );// / lu[3*idx[0]]
+ // Compare with backwardSubstitution()
+ x[idx[0]] = ( b[idx[0]] ); // / lu[3*idx[0]]
x[idx[1]] = ( b[idx[1]] - lu[3*idx[1]] * x[idx[0]] ); // / lu[3*idx[1] + 1];
x[idx[2]] = ( b[idx[2]] - lu[3*idx[2]] * x[idx[0]] - lu[3*idx[2] + 1] * x[idx[1]] ); // / lu[3*idx[2] + 2];
}
- /*
+ /**
* Solves the system Ux = b, where U is upper-triangular
*
* @param x double[3] in which the solution is stored
namespace INTERP_UTILS
{
- /*
+ /**
* Class representing an affine transformation x -> Ax + b that transforms a given tetrahedron
* into the unit tetrahedron.
*
/////////////////////////////////////////////////
/// Auxiliary methods for inverse calculation ///
/////////////////////////////////////////////////
+
void factorizeLU(double* lu, int* idx) const;
void forwardSubstitution(double* x, const double* lu, const double* b, const int* idx) const;
void backwardSubstitution(double* x, const double* lu, const double* b, const int* idx) const;
- /// The affine transformation Ax + b is represented with _linearTransformation containing the elements of
- /// A in row-first ordering and _translation containing the elements of b
+ // The affine transformation Ax + b is represented with _linearTransformation containing the elements of
+ // A in row-first ordering and _translation containing the elements of b
+
+ /// 3x3 matrix A in affine transform x -> Ax + b
double _linearTransform[9];
+
+ /// 3x1 vector b in affine transform x -> Ax + b
double _translation[3];
/// The determinant of the matrix A is calculated at the construction of the object and cached.