Class representing an affine transformation x -> Ax + b that transforms a given tetrahedron into the unit tetrahedron. More...
#include <TetraAffineTransform.hxx>
Public Member Functions | |
| TetraAffineTransform (const double **pts) | |
| PUBLIC INTERFACE METHODS //////////////. | |
| void | apply (double *destPt, const double *srcPt) const |
| Calculates the transform of point srcPt and stores the result in destPt. | |
| void | reverseApply (double *destPt, const double *srcPt) const |
| Calculates the reverse transform of point srcPt and stores the result in destPt. | |
| double | determinant () const |
| Returns the determinant of the linear part A of the transform. | |
| void | dump () const |
| Outputs to std.cout the matrix A and the vector b of the transform Ax + b. | |
Private Member Functions | |
| void | invertLinearTransform () |
| PRIVATE METHODS //////////////. | |
| void | calculateDeterminant () |
| Updates the member _determinant of the matrix A of the transformation. | |
| void | factorizeLU (double *lu, int *idx) const |
| Auxiliary methods for inverse calculation ///. | |
| void | forwardSubstitution (double *x, const double *lu, const double *b, const int *idx) const |
| Solves the system Lx = b, where L is lower unit-triangular (ones on the diagonal) | |
| void | backwardSubstitution (double *x, const double *lu, const double *b, const int *idx) const |
| Solves the system Ux = b, where U is upper-triangular. | |
Private Attributes | |
| double | _linear_transform [9] |
| 3x3 matrix A in affine transform x -> Ax + b | |
| double | _translation [3] |
| 3x1 vector b in affine transform x -> Ax + b | |
| double | _determinant |
| The determinant of the matrix A is calculated at the construction of the object and cached. | |
| double | _back_linear_transform [9] |
| 3x3 matrix AT is transposed A matrix used for y -> ATy - c transformation | |
| double | _back_translation [3] |
| 3x1 vector c in affine transform y -> ATy - c | |
Class representing an affine transformation x -> Ax + b that transforms a given tetrahedron into the unit tetrahedron.
| INTERP_KERNEL.TetraAffineTransform::TetraAffineTransform | ( | const double ** | pts | ) |
PUBLIC INTERFACE METHODS //////////////.
Constructor Create the TetraAffineTransform object from the tetrahedron with corners specified in pts. If the tetrahedron is degenerate or almost degenerate, construction succeeds, but the determinant of the transform is set to 0.
| pts | a 4x3 matrix containing 4 points (pts[0], ..., pts[3]) of 3 coordinates each |
References INTERP_KERNEL.TetraAffineTransform._back_linear_transform, INTERP_KERNEL.TetraAffineTransform._back_translation, INTERP_KERNEL.TetraAffineTransform._determinant, INTERP_KERNEL.TetraAffineTransform._linear_transform, INTERP_KERNEL.TetraAffineTransform._translation, INTERP_KERNEL.TetraAffineTransform.apply(), INTERP_KERNEL.TetraAffineTransform.calculateDeterminant(), INTERP_KERNEL.epsilonEqual(), INTERP_KERNEL.TetraAffineTransform.invertLinearTransform(), LOG, and INTERP_KERNEL.vToStr().
Calculates the transform of point srcPt and stores the result in destPt.
If destPt == srcPt, then srcPt is overwritten safely.
| destPt | double[3] in which to store the transformed point |
| srcPt | double[3] containing coordinates of points to be transformed |
References INTERP_KERNEL.TetraAffineTransform._linear_transform, INTERP_KERNEL.TetraAffineTransform._translation, and LOG.
| void INTERP_KERNEL.TetraAffineTransform::reverseApply | ( | double * | destPt, |
| const double * | srcPt | ||
| ) | const |
Calculates the reverse transform of point srcPt and stores the result in destPt.
If destPt == srcPt, then srcPt is overwritten safely.
| destPt | double[3] in which to store the transformed point |
| srcPt | double[3] containing coordinates of points to be transformed |
References INTERP_KERNEL.TetraAffineTransform._back_linear_transform, INTERP_KERNEL.TetraAffineTransform._back_translation, and LOG.
| double INTERP_KERNEL.TetraAffineTransform::determinant | ( | ) | const |
Returns the determinant of the linear part A of the transform.
References INTERP_KERNEL.TetraAffineTransform._determinant.
| void INTERP_KERNEL.TetraAffineTransform::dump | ( | ) | const |
Outputs to std.cout the matrix A and the vector b of the transform Ax + b.
References INTERP_KERNEL.TetraAffineTransform._linear_transform, and INTERP_KERNEL.TetraAffineTransform._translation.
| void INTERP_KERNEL.TetraAffineTransform::invertLinearTransform | ( | ) | [private] |
PRIVATE METHODS //////////////.
Calculates the inverse of the matrix A, stored in _linear_transform by LU-factorization and substitution
References INTERP_KERNEL.TetraAffineTransform._linear_transform, testGaussLocalization.b, INTERP_KERNEL.TetraAffineTransform.backwardSubstitution(), INTERP_KERNEL.TetraAffineTransform.factorizeLU(), INTERP_KERNEL.TetraAffineTransform.forwardSubstitution(), and LOG.
| void INTERP_KERNEL.TetraAffineTransform::calculateDeterminant | ( | ) | [private] |
Updates the member _determinant of the matrix A of the transformation.
References INTERP_KERNEL.TetraAffineTransform._determinant, and INTERP_KERNEL.TetraAffineTransform._linear_transform.
Auxiliary methods for inverse calculation ///.
Calculates the LU-factorization of the matrix A (_linear_transform) 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 (i,j) of lu, use lu[3*idx[i] + j]
| lu | double[9] in which to store LU-factorization |
| idx | int[3] in which to store row permutation vector |
References TestMedCorba7.s.
| void INTERP_KERNEL.TetraAffineTransform::forwardSubstitution | ( | double * | x, |
| const double * | lu, | ||
| const double * | b, | ||
| const int * | idx | ||
| ) | const [private] |
Solves the system Lx = b, where L is lower unit-triangular (ones on the diagonal)
| x | double[3] in which the solution is stored |
| lu | double[9] containing the LU-factorization |
| b | double[3] containing the right-hand side |
| idx | int[3] containing the permutation vector associated with lu |
| void INTERP_KERNEL.TetraAffineTransform::backwardSubstitution | ( | double * | x, |
| const double * | lu, | ||
| const double * | b, | ||
| const int * | idx | ||
| ) | const [private] |
Solves the system Ux = b, where U is upper-triangular.
| x | double[3] in which the solution is stored |
| lu | double[9] containing the LU-factorization |
| b | double[3] containing the right-hand side |
| idx | int[3] containing the permutation vector associated with lu |
3x3 matrix A in affine transform x -> Ax + b
double INTERP_KERNEL.TetraAffineTransform._translation[3] [private] |
3x1 vector b in affine transform x -> Ax + b
The determinant of the matrix A is calculated at the construction of the object and cached.
3x3 matrix AT is transposed A matrix used for y -> ATy - c transformation
3x1 vector c in affine transform y -> ATy - c