jvx.numeric

## Class PnPCA

- java.lang.Object
- - jvx.numeric.PnPCA

-     public class PnPCA
      extends java.lang.Object

  Principal 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 PdVector` | `getBarycenter(PgElementSet geom)` Compute the barycenter of an element set.
    `static PdVector` | `getBarycenter(PgElementSet geom, int[] indices)` Compute the barycenter of a subset of an element set.
    `static PdVector` | `getBarycenter(PgTetraSet geom)` Compute the barycenter of an element set.
    `static PdVector` | `getBarycenter(PgTetraSet geom, int[] indices)` Compute the barycenter of a tetra set.
    `static PdMatrix` | `getCovarianceMatrix(PgElementSet geom)` Compute the covariance matrix of an element set.
    `static PdMatrix` | `getCovarianceMatrix(PgElementSet geom, PdVector center)` Compute the covariance matrix of an element set.
    `static PdMatrix` | `getCovarianceMatrix(PgElementSet geom, PdVector center, int[] indices)` Compute the covariance matrix of a subset of an element set.
    `static PdMatrix` | `getCovarianceMatrix(PgTetraSet geom)` Compute the covariance matrix of a tetra set.
    `static PdMatrix` | `getCovarianceMatrix(PgTetraSet geom, PdVector center)` Compute the covariance matrix of a tetra set.
    `static PdMatrix` | `getCovarianceMatrix(PgTetraSet geom, PdVector center, int[] indices)` Compute the covariance matrix of a tetra set.
    `static PdVector` | `getNormal(PgElementSet geom, PdVector center)` Compute the normal of the best-fitting plane to an element set.
    `static PdVector` | `getNormal(PgElementSet geom, PdVector center, int[] indices)` Compute the normal of the best-fitting plane to a subset of an element set.
    `static PdVector` | `getNormal(PgTetraSet geom, PdVector center)` Compute the normal of the best-fitting plane to a tetra set.
    `static PdVector` | `getNormal(PgTetraSet geom, PdVector center, int[] indices)` Compute the normal of the best-fitting plane to a subset of a tetra set.
    `static PdVector` | `getWeightedBarycenter(PgTetraSet geom, PdMatrix[] tensorField, int[] indices)` Compute the barycenter of a tetra set.
    `static PdVector` | `getWeightedBarycenter(PgTetraSet geom, PgVectorField vf, int[] indices)` Compute the barycenter of a tetra set.
    `static PdMatrix` | `getWeightedCovarianceMatrix(PgTetraSet geom, PdMatrix[] tensorField, PdVector center, int[] indices)` Compute the covariance matrix of a tetra set.
    `static PdMatrix` | `getWeightedCovarianceMatrix(PgTetraSet geom, PgVectorField vf, PdVector center, int[] indices)` Compute the covariance matrix of a tetra set.
    `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.
    `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.
    `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.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PnPCA

          public PnPCA()

  - ### 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 analyze
        `center` - 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 analyze
        `center` - 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 analyze
        `center` - 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 analyze
        `center` - 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 analyze
        `center` - 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 analyze
        `tensorField` -
        `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 set
        `indices` - 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 set
        `indices` - 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 set
        `indices` - 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 set
        `center` - 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 set
        `center` - 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 set
        `center` - the barycenter of the element set
        `indices` - 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 set
        `center` - the barycenter of the element set
        `indices` - 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 set
        `center` - the barycenter of the tetra set
        `indices` - 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 set
        `tensorField` - specifies the weights
        `indices` - 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 geometry
        `noe` - 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)

"

The software JavaView? is copyright protected. All Rights Reserved.
"