public class PolarDecomposition3d
extends java.lang.Object
factor(maspack.matrix.Matrix3dBase)
method and is given by
M = Q Pwhere
Q
is orthogonal and P
is symmetric
positive definite (or indefinite if M
is singular).
Note that Q
is not necessarily right-handed. It is
possible to define an alternative decomposition,
M = R Hwhere
R
is a right-handed rotation matrix and
H
is symmetric indefinite. Alternatively, if
Q
is not right-handed, one can make it so by
negating one of its axes, using
Q' = Q Nwhere
N
is a diagonal matrix whose elements are
either 1 or -1 and whose determinant is -1. At present, this
class chooses N
with a single -1 at the same
location as the diagonal element of Q
that
is nearest to 1. The idea here is to flip the single axis
that is least affected by Q
.
The left polar decomposition is produced by
the factorLeft(maspack.matrix.Matrix3dBase)
method and is given by
M = P Qwith the alternative decomposition,
M = H RNote that the
Q
and R
matrices associated
with the right and left factorizations are identical, whereas
the P
and H
matrices are not.Constructor and Description |
---|
PolarDecomposition3d() |
PolarDecomposition3d(Matrix3dBase M) |
Modifier and Type | Method and Description |
---|---|
void |
factor(Matrix3dBase M) |
void |
factorLeft(Matrix3dBase M) |
void |
getH(Matrix3d H) |
int |
getMaxQDiagIndex()
Returns the index of the maximum diagonal element of
Q . |
void |
getN(Vector3d Ndiag)
Return the diagonal elements of the matrix
N which
is used to flip rows or columns of Q (or some
product thereof) in the event that Q is not right-handed. |
Matrix3d |
getP() |
void |
getP(Matrix3d P) |
Matrix3d |
getQ() |
void |
getQ(Matrix3d Q) |
RotationMatrix3d |
getR() |
void |
getR(Matrix3dBase R) |
void |
getSig(Vector3d sig) |
Matrix3d |
getV() |
boolean |
isRightHanded() |
void |
makeRightHanded(RotationMatrix3d R)
Flip an axis of R in order to make it right-handed.
|
public PolarDecomposition3d()
public PolarDecomposition3d(Matrix3dBase M)
public void factor(Matrix3dBase M)
public void factorLeft(Matrix3dBase M)
public RotationMatrix3d getR()
public void getR(Matrix3dBase R)
public Matrix3d getQ()
public void getQ(Matrix3d Q)
public void getH(Matrix3d H)
public Matrix3d getP()
public void getP(Matrix3d P)
public Matrix3d getV()
public void getSig(Vector3d sig)
public boolean isRightHanded()
public void getN(Vector3d Ndiag)
N
which
is used to flip rows or columns of Q
(or some
product thereof) in the event that Q
is not right-handed.
If det(Q) == 1
, then N
is the identity
matrix. Otherwise, if det(Q) = -1
, then N
flips the column corresponding to the diagonal element of Q
which is nearest to 1.Ndiag
- returns the diagonal elements of N
.public int getMaxQDiagIndex()
Q
.
This is used to create the matrix N
which is
returned by getN(maspack.matrix.Vector3d)
.Q
.public void makeRightHanded(RotationMatrix3d R)
R
- unitary matrix