jvx.numeric
Class PnPCA
- java.lang.Object
-
- jvx.numeric.PnPCA
-
public class PnPCA extends java.lang.ObjectPrincipal component analysis of an element set and tetra set.- Author:
- Ulrich Bauer
- Version:
- 25.03.19, 3.00 revised (ms) Corrected bug in transformToNormalPosition method.
09.03.15, 2.00 revised (kp) Moved to jvx.numeric from dev.numeric.
03.09.09, 1.20 revised (mn) Cleaned code and comment methods.
xx.xx.09, 1.10 revised (mn) Add method transformToNormalPosition().
14.06.07, 1.00 created (ep)
-
-
Constructor Summary
Constructors Constructor and Description PnPCA()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static PdVectorgetBarycenter(PgElementSet geom)Compute the barycenter of an element set.static PdVectorgetBarycenter(PgElementSet geom, int[] indices)Compute the barycenter of a subset of an element set.static PdVectorgetBarycenter(PgTetraSet geom)Compute the barycenter of an element set.static PdVectorgetBarycenter(PgTetraSet geom, int[] indices)Compute the barycenter of a tetra set.static PdMatrixgetCovarianceMatrix(PgElementSet geom)Compute the covariance matrix of an element set.static PdMatrixgetCovarianceMatrix(PgElementSet geom, PdVector center)Compute the covariance matrix of an element set.static PdMatrixgetCovarianceMatrix(PgElementSet geom, PdVector center, int[] indices)Compute the covariance matrix of a subset of an element set.static PdMatrixgetCovarianceMatrix(PgTetraSet geom)Compute the covariance matrix of a tetra set.static PdMatrixgetCovarianceMatrix(PgTetraSet geom, PdVector center)Compute the covariance matrix of a tetra set.static PdMatrixgetCovarianceMatrix(PgTetraSet geom, PdVector center, int[] indices)Compute the covariance matrix of a tetra set.static PdVectorgetNormal(PgElementSet geom, PdVector center)Compute the normal of the best-fitting plane to an element set.static PdVectorgetNormal(PgElementSet geom, PdVector center, int[] indices)Compute the normal of the best-fitting plane to a subset of an element set.static PdVectorgetNormal(PgTetraSet geom, PdVector center)Compute the normal of the best-fitting plane to a tetra set.static PdVectorgetNormal(PgTetraSet geom, PdVector center, int[] indices)Compute the normal of the best-fitting plane to a subset of a tetra set.static PdVectorgetWeightedBarycenter(PgTetraSet geom, PdMatrix[] tensorField, int[] indices)Compute the barycenter of a tetra set.static PdVectorgetWeightedBarycenter(PgTetraSet geom, PgVectorField vf, int[] indices)Compute the barycenter of a tetra set.static PdMatrixgetWeightedCovarianceMatrix(PgTetraSet geom, PdMatrix[] tensorField, PdVector center, int[] indices)Compute the covariance matrix of a tetra set.static PdMatrixgetWeightedCovarianceMatrix(PgTetraSet geom, PgVectorField vf, PdVector center, int[] indices)Compute the covariance matrix of a tetra set.static PdVectorgetWeightedNormal(PgTetraSet geom, PgVectorField vf, PdVector center, int[] indices)Compute the normal of the best-fitting plane to a subset of a tetra set.static voidtransformCoordinateSystem(PgGeometry geom, PdVector origin, PdVector[] basis, int nov, int noe)This method expresses a PgPointSet (given in standard basis) in a new coordinate system, given by a new origin and basis.static voidtransformToNormalPosition(PgElementSet geom)Translates and rotates a surface, such that its barycenter lies in the origin and the three eigenvectors of the covariance matrix are aligned to the axes.
-
-
-
Method Detail
-
getCovarianceMatrix
public static PdMatrix getCovarianceMatrix(PgElementSet geom)
Compute the covariance matrix of an element set.- Parameters:
geom- The element set to analyze- Returns:
- The covariance matrix of the element set
-
getCovarianceMatrix
public static PdMatrix getCovarianceMatrix(PgElementSet geom, PdVector center)
Compute the covariance matrix of an element set.- Parameters:
geom- The element set to analyzecenter- The center of covariance analysis (expectation)- Returns:
- The covariance matrix of the element set
-
getCovarianceMatrix
public static PdMatrix getCovarianceMatrix(PgElementSet geom, PdVector center, int[] indices)
Compute the covariance matrix of a subset of an element set.- Parameters:
geom- The element set to analyzecenter- The center of covariance analysis (expectation)indices- The indices of the subset- Returns:
- The covariance matrix of the subset of the element set
-
getCovarianceMatrix
public static PdMatrix getCovarianceMatrix(PgTetraSet geom)
Compute the covariance matrix of a tetra set.- Parameters:
geom- The tetra set to analyze- Returns:
- The covariance matrix of the tetra set
-
getCovarianceMatrix
public static PdMatrix getCovarianceMatrix(PgTetraSet geom, PdVector center)
Compute the covariance matrix of a tetra set.- Parameters:
geom- The tetra set to analyzecenter- The center of covariance analysis (expectation)- Returns:
- The covariance matrix of the tetra set
-
getCovarianceMatrix
public static PdMatrix getCovarianceMatrix(PgTetraSet geom, PdVector center, int[] indices)
Compute the covariance matrix of a tetra set.- Parameters:
geom- The tetra set to analyzecenter- The center of covariance analysis (expectation)indices- Set of elements, which are treated by this method- Returns:
- The covariance matrix of the tetra set
-
getWeightedCovarianceMatrix
public static PdMatrix getWeightedCovarianceMatrix(PgTetraSet geom, PgVectorField vf, PdVector center, int[] indices)
Compute the covariance matrix of a tetra set.- Parameters:
geom- The tetra set to analyzecenter- The center of covariance analysis (expectation)- Returns:
- The covariance matrix of the tetra set
-
getWeightedCovarianceMatrix
public static PdMatrix getWeightedCovarianceMatrix(PgTetraSet geom, PdMatrix[] tensorField, PdVector center, int[] indices)
Compute the covariance matrix of a tetra set.- Parameters:
geom- The tetra set to analyzetensorField-center- The center of covariance analysis (expectation)indices-- Returns:
- The covariance matrix of the tetra set
-
getBarycenter
public static PdVector getBarycenter(PgElementSet geom)
Compute the barycenter of an element set.- Parameters:
geom- The element set- Returns:
- The barycenter of the element set
-
getBarycenter
public static PdVector getBarycenter(PgTetraSet geom)
Compute the barycenter of an element set.- Parameters:
geom- The element set- Returns:
- The barycenter of the element set
-
getBarycenter
public static PdVector getBarycenter(PgElementSet geom, int[] indices)
Compute the barycenter of a subset of an element set.- Parameters:
geom- The element setindices- The indices of the subset- Returns:
- The barycenter of the element set
-
getBarycenter
public static PdVector getBarycenter(PgTetraSet geom, int[] indices)
Compute the barycenter of a tetra set.- Parameters:
geom- The tetra setindices- The indices of the subset- Returns:
- The barycenter of the tetra set
-
getWeightedBarycenter
public static PdVector getWeightedBarycenter(PgTetraSet geom, PgVectorField vf, int[] indices)
Compute the barycenter of a tetra set.- Parameters:
geom- The tetra setindices- The indices of the subset- Returns:
- The barycenter of the tetra set
-
getNormal
public static PdVector getNormal(PgElementSet geom, PdVector center)
Compute the normal of the best-fitting plane to an element set. Together with the barycenter, this defines the best fitting plane.- Parameters:
geom- the element setcenter- the barycenter of the element set- Returns:
- the normal of the best-fitting plane
-
getNormal
public static PdVector getNormal(PgTetraSet geom, PdVector center)
Compute the normal of the best-fitting plane to a tetra set. Together with the barycenter, this defines the best fitting plane.- Parameters:
geom- the tetra setcenter- the barycenter of the tetra set- Returns:
- the normal of the best-fitting plane
-
getNormal
public static PdVector getNormal(PgElementSet geom, PdVector center, int[] indices)
Compute the normal of the best-fitting plane to a subset of an element set. Together with the barycenter, this defines the best fitting plane.- Parameters:
geom- the element setcenter- the barycenter of the element setindices- the indices of the subset- Returns:
- The normal of the best-fitting plane
-
getNormal
public static PdVector getNormal(PgTetraSet geom, PdVector center, int[] indices)
Compute the normal of the best-fitting plane to a subset of a tetra set. Together with the barycenter, this defines the best fitting plane.- Parameters:
geom- the tetra setcenter- the barycenter of the element setindices- the indices of the subset- Returns:
- The normal of the best-fitting plane
-
getWeightedNormal
public static PdVector getWeightedNormal(PgTetraSet geom, PgVectorField vf, PdVector center, int[] indices)
Compute the normal of the best-fitting plane to a subset of a tetra set. Together with the barycenter, this defines the best fitting plane.- Parameters:
geom- the tetra setcenter- the barycenter of the tetra setindices- the indices of the subset- Returns:
- The normal of the best-fitting plane
-
getWeightedBarycenter
public static PdVector getWeightedBarycenter(PgTetraSet geom, PdMatrix[] tensorField, int[] indices)
Compute the barycenter of a tetra set.- Parameters:
geom- the tetra settensorField- specifies the weightsindices- the indices of the subset- Returns:
- the barycenter of the tetra set
-
transformToNormalPosition
public static void transformToNormalPosition(PgElementSet geom)
Translates and rotates a surface, such that its barycenter lies in the origin and the three eigenvectors of the covariance matrix are aligned to the axes. The x-axis corresponds to the biggest eigenvalue, the z-axis to the smallest one.- Author:
- Matthias Nieser, Martin Skrodzki
- Version:
- 25.03.19, 2.00 revised (ms) Removed a bug that caused the method to not provide a unique result. 18.05.09, 1.00 created (mn)
-
transformCoordinateSystem
public static void transformCoordinateSystem(PgGeometry geom, PdVector origin, PdVector[] basis, int nov, int noe)
This method expresses a PgPointSet (given in standard basis) in a new coordinate system, given by a new origin and basis.- Parameters:
geom- The point cloud, which we want to express in new coordinates.origin- The new location to which the coordinate system gets moved.basis- The new basis for our new coordinate system.nov- The number of vertices of the underlying geometrynoe- The number of elements of the underlying geometry- Version:
- 15.11.2017, 1.10 revised (ez) matrix m needs basis as columns 13.11.2017, 1.00 created (ez)
-
-
"