jvx.numeric

## Class PnStraightestGeodesic

- java.lang.Object
- - jvx.numeric.PnStraightestGeodesic

-     public class PnStraightestGeodesic
      extends java.lang.Object

  The exponential map on a PgElementSet. This class is intended to be used when the exponential map is evaluated very often. The basic idea is to speed up the calculations by computing and saving the linear transformations (3x3 matrices) that rotate around an edge from one element into another. These edge transformations can be computed all at once, when `setGeometry` is called, or only when needed.

  Example:

          exp = new PnStraightestGeodesic(geom);
          exp.eval(inPoint, inDir, outPoint, outDir, outPoly);
          // turn around and go back
          outDir.multScalar(-1);
          exp.eval(outPoint, outDir, revOutPoint, revOutDir);

  Now `inPoint` represents the same point as `revOutPoint`. Point being: If the geometry boundary is reached, `outDir` is scaled down to preserve this invariant. In this case, inDir and revOutDir may represent vectors of different length.

  `inPoint` and `revOutPoint` are not necessarily on the same triangle (see below), but `outPoly.getVertexBary(0)` and `revOutPoint` are. Of course, `outPoint` is the last point of `outPoly`.

  Barycentric coordinates are used to represent points and vectors. The geometry must be triangulated.

  Author:
    Andreas Haferburg
  Version:
    11.01.07, 1.10 revised (ah) Error check in computeTransformation.
    01.03.06, 1.00 created (ah) Rewrite of `PgPolygonOnElementSet.exp()`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `BARYEPS` Default accuracy used at checks for zero in barycentric coordinates (used e.g. in exp(...)).
    `double` | `m_eps` This accuracy is actually used for zero-checks in barycentric coordinates (used e.g. in exp(...)).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PnStraightestGeodesic(PgElementSet geometry)` Creates a new instance of PnStraightestGeodesic.
    `PnStraightestGeodesic(PgElementSet geometry, boolean precompute)` Creates a new instance of PnStraightestGeodesic.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `eval(PdBary basePoint, PdBaryDir dir, PdBary outPoint)` Evaluates the exponential map.
    `int` | `eval(PdBary basePoint, PdBaryDir dir, PdBary outPoint, PdBaryDir outDir)` Evaluates the exponential map.
    `int` | `eval(PdBary base, PdBaryDir dir, PdBary outPoint, PdBaryDir outDir, PgPolygonOnElementSet outPoly)` Evaluates the exponential map.
    `int` | `eval(PdBary basePoint, PdBaryDir dir, PgPolygonOnElementSet outPoly)` Evaluates the exponential map.
    `int` | `eval(PdBary basePoint, PdBaryDir dir, PgPolygonOnElementSet outPoly, PdBaryDir outDir)` Evaluates the exponential map.
    `double` | `getAccuracy()` Returns the accuracy used when testing barycentric coordinates for zero.
    `PgElementSet` | `getGeometry()` Returns the underlying geometry.
    `boolean` | `isSavingMatrices()` Returns whether the linear transformations that rotate from one element into its neighbor are saved in an array.
    `void` | `setAccuracy(double accuracy)` Sets the accuracy used when testing a barycentric coordinate for zero.
    `void` | `setGeometry(PgElementSet geom)` Sets the underlying geometry.
    `void` | `setSavingMatrices(boolean bStoreMatrices)` Sets if the edge transformations should be stored for later use.

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

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

- - ### Field Detail

    - #### BARYEPS

          public static double BARYEPS

      Default accuracy used at checks for zero in barycentric coordinates (used e.g. in exp(...)).

    - #### m_eps

          public double m_eps

      This accuracy is actually used for zero-checks in barycentric coordinates (used e.g. in exp(...)).

  - ### Constructor Detail

    - #### PnStraightestGeodesic

          public PnStraightestGeodesic(PgElementSet geometry)

      Creates a new instance of PnStraightestGeodesic. Calls setGeometry.
      Parameters:
        `geometry` - The underlying geometry.

    - #### PnStraightestGeodesic

          public PnStraightestGeodesic(PgElementSet geometry,
                                       boolean precompute)

      Creates a new instance of PnStraightestGeodesic. Calls setGeometry.
      Parameters:
        `geometry` - The underlying geometry.
        `precompute` - Compute the 3x3-matrices that represent the rotations around edges of adjacent elements. For every edge, 2 matrices are computed.

  - ### Method Detail

    - #### eval

          public int eval(PdBary basePoint,
                          PdBaryDir dir,
                          PdBary outPoint)

      Evaluates the exponential map.
      Parameters:
        `basePoint` - The point defining the tangent space.
        `dir` - The input vector in tangent space at which the exponential map is evaluated.
        `outPoint` - The output point.
      Returns:
        1 if everything went normally, -1 if the base is invalid, 0 if the geometry boundary was reached.

    - #### eval

          public int eval(PdBary basePoint,
                          PdBaryDir dir,
                          PdBary outPoint,
                          PdBaryDir outDir)

      Evaluates the exponential map.
      Parameters:
        `basePoint` - The point defining the tangent space.
        `dir` - The input vector in tangent space at which the exponential map is evaluated.
        `outPoint` - The output point.
        `outDir` - Parallel translation of dir.
      Returns:
        1 if everything went normally, -1 if the base is invalid, 0 if the geometry boundary was reached.

    - #### eval

          public int eval(PdBary basePoint,
                          PdBaryDir dir,
                          PgPolygonOnElementSet outPoly,
                          PdBaryDir outDir)

      Evaluates the exponential map.
      Parameters:
        `basePoint` - The point defining the tangent space.
        `dir` - The input vector in tangent space at which the exponential map is evaluated.
        `outDir` - Parallel translation of dir.
        `outPoly` - Output geodesic.
      Returns:
        1 if everything went normally, -1 if the base is invalid, 0 if the geometry boundary was reached.

    - #### eval

          public int eval(PdBary basePoint,
                          PdBaryDir dir,
                          PgPolygonOnElementSet outPoly)

      Evaluates the exponential map.
      Parameters:
        `basePoint` - The point defining the tangent space.
        `dir` - The input vector in tangent space at which the exponential map is evaluated.
        `outPoly` - Output geodesic.
      Returns:
        1 if everything went normally, -1 if the base is invalid, 0 if the geometry boundary was reached.

    - #### eval

          public int eval(PdBary base,
                          PdBaryDir dir,
                          PdBary outPoint,
                          PdBaryDir outDir,
                          PgPolygonOnElementSet outPoly)

      Evaluates the exponential map. The last two points of outPoly are guaranteed to be on the same element, and two consecutive points will be on elements that are neighbors.
      Normally, `base` is the first point of the outPoly. However, in the special case where `base` is on an edge or a vertex, and `dir` doesn't point at `base`'s element, `base` won't be included in the output, but only the representation in a triangle `dir` points at.
      Parameters:
        `base` - The point defining the tangent space.
        `dir` - The input vector in tangent space at which the exponential map is evaluated.
        `outPoint` - The output point, may be null.
        `outDir` - Parallel translation of dir, may be null.
        `outPoly` - Output geodesic, may be null.
      Returns:
        1 if everything went normally, -1 if the base is invalid, 0 if the geometry boundary was reached.
      Version:
        01.03.06, 1.01 (ah) Modify poly vertices directly to avoid copying.

    - #### setGeometry

          public void setGeometry(PgElementSet geom)

      Sets the underlying geometry. Computes the edge transformations if it was specified in the constructor.
      Parameters:
        `geom` - New underlying geometry, must be triangulated.

    - #### getGeometry

          public PgElementSet getGeometry()

      Returns the underlying geometry.
      Returns:
        The underlying geometry.

    - #### getAccuracy

          public double getAccuracy()

      Returns the accuracy used when testing barycentric coordinates for zero.
      Returns:
        the accuracy

    - #### setAccuracy

          public void setAccuracy(double accuracy)

      Sets the accuracy used when testing a barycentric coordinate for zero. In all methods of this class, a barycentric coordinate b is treated as zero, iff `Math.abs(b)<m_accuracy`
      Parameters:
        `accuracy` - Accuracy to be used.

    - #### isSavingMatrices

          public boolean isSavingMatrices()

      Returns whether the linear transformations that rotate from one element into its neighbor are saved in an array.
      Returns:
        Edge transformations are saved.

    - #### setSavingMatrices

          public void setSavingMatrices(boolean bStoreMatrices)

      Sets if the edge transformations should be stored for later use.
      Parameters:
        `bStoreMatrices` - matrices are stored.

"

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