jvx.geom

## Class PwBary

- java.lang.Object
- - jvx.geom.PwBary

-     public final class PwBary
      extends java.lang.Object

  Static methods that handle barycentric coordinates on triangulated element sets.
  Author:
    Eike Preuss
  Version:
    07.03.06, 1.20 revised (kp) Merged with (ah) version
    01.03.06, 1.18 revised (ah) Improved `scalar` and `norm`
    22.10.05, 1.10 revised (kp) Method liesOnEdge() included from PjTranslate.
    24.10.01, 1.07 revised (ep) A check removed...it wasn't correct...
    19.09.01, 1.06 revised (ep) A few checks added.
    11.07.01, 1.05 revised (ep) Speed optimized a little (not in 'representations').
    26.01.00, 1.04 revised (ep) Corrected and changed getTransRepr(-Values).
    09.01.00, 1.03 revised (ep) Methods get...Repr extended.
    04.01.00, 1.02 revised (ep) Method getGeodTransRepr corrected.
    21.11.99, 1.00 created (ep)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PwBary()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `changeBarycentricOnEdge(PdBary inOut, int locind1, int locind2)` Switch to barycentric coordinates that represent same point on edge wrt the other element adjacent to edge.
    `static boolean` | `changeBarycentricOnEdge(PgElementSet geom, PdBaryDir baryDir, int locInd)` Changes the barycentric representation of a vector in an element with respect to a neighbour element.
    `static int` | `changeBarycentricOnEdge(PgElementSet geom, PdBary inoutBary, int locInd)` A given point in element e will be projected to an adjacent edge and its barycentric coordinates in the neighbour triangle is returned.
    `static double` | `computeLambda(PdBary pos, PdBaryDir dir)` Computes the smallest positive solution of 'pos + lambda*dir lies on boundary' for lambda.
    `static PdBaryDir[]` | `computeNormals(PgPolygonOnElementSet poly, PdBaryDir[] normals, PiVector elementind)` TODO: DOES NOT WORK WITH CLOSED POLYGONS YET!
    `static int` | `equalizeElementIndex(PgPolygonOnElementSet poly, int index1, int index2, PdBary out1, PdBary out2)` Outputs the coordinates of two vertices on a barycentric polygon such that their barycentric coordinates refer to the same element.
    `static PdBary[]` | `getBaryDescriptions(PgElementSet geom, PdBary bary, double eps)` Get the barycentric coordinates of a given point in all elements, which contains this point. (2, if it lies on an edge, more if it lies on a vertex).
    `static int` | `getEdgeIndex(PdBary pos)` Checks for first occurrence of zero (i.e.
    `static PdBaryDir[]` | `getGeodRepresentation(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector localind)` Calculates the representations of a given vector in all elements of a vertex star by completion to a unnormalized angle of theta/2.
    `static double` | `getOrientedAngle(PgElementSet geom, int elemInd, PdBaryDir a, PdBaryDir b, boolean recalc)` Oriented angle between two barycentric vectors in a triangle.
    `static double` | `getOrientedAngleAtEdge(PgElementSet geom, int elemind1, PdBaryDir dir1, int localedgeind1, int elemind2, PdBaryDir dir2, int localedgeind2, boolean recalc)`
    `static double` | `getOrientedAngleAtVertex(PgElementSet geom, int elemind1, PdBaryDir dir1, int localvertind1, int elemind2, PdBaryDir dir2, int localvertind2, boolean recalc)` Computes the normalized angle between two barycentric vectors based at the same vertex.
    `static PdBaryDir[]` | `getProjRepresentation(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector locind)` Calculates the representations of a given vector in all elements of a vertex star by projection onto the plane the element lays in.
    `static PdBaryDir[]` | `getTransRepresentation(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector locind)` Calculates the representations of a given vector in all elements of a vertex star by parallel translation along a straightest geodesic (half angles).
    `static double` | `getTransRepresentationValues(PgElementSet geom, int origElem, PdBaryDir origDir, int localvertexindex, PiVector elements, PiVector locind, PdVector betas)` Calculates the values (beta,theta) of a given vector in all elements of a vertex star by parallel translation along a straightest geodesic.
    `static PdVector` | `getVector(PdVector dir, PgElementSet geom, PdBaryDir baryDir)` Get the coordinates of a vector from its barycentric coordinates.
    `static PdVector` | `getVertex(PdVector vertex, PgElementSet geom, PdBary bary)` Get the coordinates of a vertex from its barycentric coordinates.
    `static PdVector` | `getVertex(PdVector vertex, PgPolygon polygon, PdBary bary)` Get vertex from barycentric coordinates on a polygon.
    `static double` | `getVertexAngles(PgVertexStar star, PgElementSet geom, PdVector angles)` Calculates inner angles of the elements of a vertex star.
    `static int` | `liesOnEdge(PdBary pos)` Checks if given barycentric position lies within PuMath.EPS distance to the interior of an edge, and away from vertices.
    `static int` | `liesOnVertex(PdBary pos)` Checks if given barycentric position lies within PuMath.EPS range of a vertex, and returns local index of that vertex.
    `static boolean` | `makeBaryDescription(PgElementSet geom, PdBary bary, int newElement, double eps)` Try to make a barycentric description of a point w.r.t. a specidied element in the geometry.
    `static boolean` | `makeCommonBaryDescription(PgElementSet geom, PdBary bary1, PdBary bary2, double eps)` Convert the barycentric coordinates of two points on a surface, such that they are described w.r.t. the same triangle of the surface.
    `static PdBary` | `newVertexBary(int element, int locVertInd)` Make a new PdBary instance representing a vertex on the given element set.
    `static double` | `norm(PgElementSet geom, int elemInd, PdBaryDir x, boolean geometryChanged)` Euclidean norm of two intrinsic (barycentric) vectors.
    `static PdBary` | `projectOntoElement(PgElementSet geom, int elementIdx, PdVector point, PdBary outBary)` Project a point from R^3 to an element of geom in normal direction.
    `static boolean` | `projectOntoElement(PgElementSet geom, int elemInd, PdVector vector, PdBaryDir outdir)` Projects given vector onto elements plane.
    `static PdBary` | `projectOntoElement(PgElementSet geom, int elementIdx, PdVector point, PdVector dir, PdBary outBary)` Project a point from R^3 to an element of geom.
    `static void` | `projectOntoElementEdge(int edgeInd, PdBary bary)` Project the barycentric coordinates from a point to an edge of the barycentric triangle.
    `static void` | `projectOntoElementEdge(PgElementSet geom, PdBary bary, int edgeInd)` Project a point from R^3 to an element edge of geom.
    `static PdBary` | `projectOntoElementSet(PgElementSet geom, PdVector point, PdBary outBary)` Project a point from R^3 to a surface.
    `static double` | `projectOntoPolygon(PdVector vertex, PgPolygon polygon, PdBary bary2D)` Project a vertex onto its nearest point on a given polygon.
    `static void` | `projectToInside(PgElementSet target, PdBary inOutBary)` Projects the given point inside the specified triangle.
    `static int` | `rotateAtEdge(PgElementSet geom, int elem, PdBaryDir dir, int localedgeind, PdBaryDir out, PdBary pos, double angle, boolean recalc)` Rotates a barycentric direction with base point on edge.
    `static int` | `rotateAtVertex(PgElementSet geom, int elemind, int localvertexind, PdBaryDir dir, PdBaryDir outdir, PdBary bary, double angle)` Rotates direction at vertex in same orientation as the star.
    `static void` | `rotateInElement(PgElementSet geom, int elemInd, PdBaryDir dir, double angle, PdBaryDir outdir, boolean bForceRecalc)` Rotates direction in same orientation as the element's.
    `static double` | `scalar(PgElementSet geom, int elemInd, PdBaryDir x, PdBaryDir y, boolean geometryChanged)` Computes scalar product of barycentric directions in world coordinates, that means the scalar product of the vectors in Euclidean space.
    `static boolean` | `showsIntoElement(PdBaryDir dir, int vertexindex)` Checks if given barycentric vector shows into its element.
    `static PdBaryDir` | `subBary(PgElementSet geom, PdBary b1, PdBary b2, PdBaryDir outDir)` Substract two points on a surface in barycentric coordinates.
    `static boolean` | `transformBary(PgElementSet geom, int origElem, PdBary origBary, int destElem, PdBary outBary)` Tries to change a barycentric coordinate to the representation of the same space point w.r.t. a different triangle.
    `static void` | `translatePolygonOnElementSet(PgPolygonOnElementSet poly, PdBaryDir[] vf, PiVector vfInd, PdVector distField)` Translates the vertices of the polygon a given distance into a given direction.
    `static PdBary` | `vertexToBary(PgElementSet geom, int vertex, int neighbourElement)` Create barycentric coordinates of a given vertex in a PgElementSet.

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

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

- - ### Constructor Detail

    - #### PwBary

          public PwBary()

  - ### Method Detail

    - #### scalar

          public static double scalar(PgElementSet geom,
                                      int elemInd,
                                      PdBaryDir x,
                                      PdBaryDir y,
                                      boolean geometryChanged)

      Computes scalar product of barycentric directions in world coordinates, that means the scalar product of the vectors in Euclidean space. The directions have to live on the same element. If geometry and element index are the same as they were at previous call of `scalar` and `!geometryChanged` then some calculations are skipped.
      Parameters:
        `geom` - geometry the barycentric directions live on
        `elemInd` - element the barycentric directions live on
        `x` - one direction
        `y` - other direction
        `geometryChanged` - if `true` all variables are forced to be recalculated; should only be used if the vertex positions may have changed
      Returns:
        scalar product
      Version:
        01.03.06, 1.01 revised (ah) Faster algorithm.

    - #### norm

          public static double norm(PgElementSet geom,
                                    int elemInd,
                                    PdBaryDir x,
                                    boolean geometryChanged)

      Euclidean norm of two intrinsic (barycentric) vectors. Implemented as copy of the method `PwBary.scalar` and additional square root.
      Parameters:
        `geom` - the geometry the barycentric direction lives on
        `elemInd` - the element the barycentric direction lives on
        `x` - barycentric vector
        `geometryChanged` - if `true` all variables are forced to be recalculated; should only be used if the vertex positions may have changed
      Returns:
        `sqrt(<x,x>)`
      See Also:
        `scalar(jv.geom.PgElementSet, int, jv.vecmath.PdBaryDir, jv.vecmath.PdBaryDir, boolean)`
      Version:
        01.03.06, 1.01 revised (ah) Faster algorithm.

    - #### getVertexAngles

          public static double getVertexAngles(PgVertexStar star,
                                               PgElementSet geom,
                                               PdVector angles)

      Calculates inner angles of the elements of a vertex star. Only for triangulations. User has to ensure that star is already computed, and that geom and angles parameters are not null.
      Parameters:
        `star` - the star
        `geom` - the geometry
        `angles` - output: vertex angles of elements in star, in same order as `PgVertexStar.getElement()`. if necessary it is resized.
      Returns:
        sum of the angles
      Version:
        1.00, August 1999 created (ep)

    - #### getGeodRepresentation

          public static PdBaryDir[] getGeodRepresentation(PgElementSet geom,
                                                          int origElem,
                                                          PdBaryDir origDir,
                                                          int localvertexindex,
                                                          PiVector elements,
                                                          PiVector localind)

      Calculates the representations of a given vector in all elements of a vertex star by completion to a unnormalized angle of theta/2. Element set must be triangulated.
      Parameters:
        `geom` - triangulation
        `origElem` - element in which the vector is given
        `origDir` - vector that will be translated to the other elements
        `localvertexindex` - local index in `origElem` of the vertex at which the vector is given
        `elements` - output: global element indices of the vertex star
        `localind` - output: local vertex indices of common vertex in elements at vertex star
      Returns:
        array of the calculated directions at success, null else
      Version:
        09.01.00, (ep) return local vertex indices by parameter
        27.12.99, (ep) handling of |dir| == 0

    - #### getTransRepresentation

          public static PdBaryDir[] getTransRepresentation(PgElementSet geom,
                                                           int origElem,
                                                           PdBaryDir origDir,
                                                           int localvertexindex,
                                                           PiVector elements,
                                                           PiVector locind)

      Calculates the representations of a given vector in all elements of a vertex star by parallel translation along a straightest geodesic (half angles). Element set must be triangulated.
      Parameters:
        `geom` - triangulation
        `origElem` - element in which the vector is given
        `origDir` - vector that will be translated to the other elements
        `localvertexindex` - the local index in `origElem` of the vertex in which the vector is given
        `elements` - output: global element indices of the vertex star
        `locind` - output: local vertex indices of the vertex star
      Returns:
        array of the calculated directions at success, null else
      Version:
        09.01.00, (ep) return local vertex indices by parameter
        04.01.00, (ep) corrected.
        27.12.99, (ep) handling of |dir| == 0

    - #### getTransRepresentationValues

          public static double getTransRepresentationValues(PgElementSet geom,
                                                            int origElem,
                                                            PdBaryDir origDir,
                                                            int localvertexindex,
                                                            PiVector elements,
                                                            PiVector locind,
                                                            PdVector betas)

      Calculates the values (beta,theta) of a given vector in all elements of a vertex star by parallel translation along a straightest geodesic. Rotate counter-clockwise next edge by angleOfEvaluationPointToEdge - 2*PI/theta*(beta+angle), where angle is the angle between evaluation position and edge. Element set must be triangulated.
      Parameters:
        `geom` - set of elements
        `origElem` - element in which the vector is given
        `origDir` - vector that will be translated to the other elements
        `localvertexindex` - the local index in `origElem` of the vertex in which the vector is given
        `elements` - output: global element indices of the vertex star, beginning with origElem
        `locind` - output: local indices of common vertex of star, beginning with localvertexindex
        `betas` - output: beta values
      Returns:
        theta
      Version:
        26.01.00, (ep) only translate out of the star
        27.12.99, (ep) created

    - #### getProjRepresentation

          public static PdBaryDir[] getProjRepresentation(PgElementSet geom,
                                                          int origElem,
                                                          PdBaryDir origDir,
                                                          int localvertexindex,
                                                          PiVector elements,
                                                          PiVector locind)

      Calculates the representations of a given vector in all elements of a vertex star by projection onto the plane the element lays in. Element set must be triangulated.
      Parameters:
        `geom` - set of elements
        `origElem` - element on which the vector is given
        `origDir` - vector that will be translated to the other elements
        `localvertexindex` - the local index in `origElem` of the vertex in which the vector is given
        `elements` - output: global element indicee of the vertex star
        `locind` - output: local vertex indices of the vertex star
      Returns:
        array of the calculated directions at success, null else
      Version:
        09.01.00, (ep) return local vertex indices by parameter
        27.12.99, (ep) handling of dirabs == 0;

    - #### projectOntoElement

          public static boolean projectOntoElement(PgElementSet geom,
                                                   int elemInd,
                                                   PdVector vector,
                                                   PdBaryDir outdir)

      Projects given vector onto elements plane.
      Parameters:
        `geom` - underlying geometry
        `elemInd` - global element index
        `vector` - in world coordinates
        `outdir` - output: barycentric coordinates of the projected vector
      Returns:
        True, if no error occurs.
      Version:
        29.11.99, 1.01 renamed (ep)

    - #### projectOntoElement

          public static PdBary projectOntoElement(PgElementSet geom,
                                                  int elementIdx,
                                                  PdVector point,
                                                  PdBary outBary)

      Project a point from R^3 to an element of geom in normal direction. This method assumes correct element normals.
      Parameters:
        `geom` - Underlying triangulated surface in R^3.
        `elementIdx` - Index of a triangle in geom.
        `point` - Point in R^3 to project.
        `outBary` - Output for projected point. May be null.
      Returns:
        Barycentric coordinates of projected point.
      Author:
        Matthias Nieser
      Version:
        14.08.2006, 1.00 created (mn)

    - #### projectOntoElement

          public static PdBary projectOntoElement(PgElementSet geom,
                                                  int elementIdx,
                                                  PdVector point,
                                                  PdVector dir,
                                                  PdBary outBary)

      Project a point from R^3 to an element of geom.
      Parameters:
        `geom` - Underlying triangulated surface in R^3.
        `elementIdx` - Index of a triangle in geom.
        `point` - Point in R^3 to project.
        `dir` - Projection direction.
        `outBary` - Output for projected point. May be null.
      Returns:
        Barycentric coordinates of projected point or null if the triangle is degenerated.
      Author:
        Matthias Nieser
      Version:
        03.07.2007, 1.00 created (mn)

    - #### projectOntoElementEdge

          public static void projectOntoElementEdge(PgElementSet geom,
                                                    PdBary bary,
                                                    int edgeInd)

      Project a point from R^3 to an element edge of geom. If `outBary` is `null`, a new `PdBary` is created and returned.
      Parameters:
        `geom` - Base geometry.
        `bary` - Barycentric coordinates of point to be projected. Will be modified.
        `edgeInd` - Target local edge index.
      Author:
        Andreas Haferburg
      Version:
        28.06.07, 2.00 revised (mn) Removed unnecessary parameter. Cleaned code.
        23.01.07, 1.00 created (ah)

    - #### projectToInside

          public static void projectToInside(PgElementSet target,
                                             PdBary inOutBary)

      Projects the given point inside the specified triangle. The result is the point of the triangle with non-negative barycentric coordinates and the smallest Euclidean distance to the given point.
      Parameters:
        `target` - Base geometry.
        `inOutBary` - Point in barycentric coordinates wrt the triangle in which it should be projected.
      Author:
        Andreas Haferburg
      Version:
        28.06.07, 2.00 revised (mn) Removed unnecessary parameter.
        02.04.07, 1.00 created (ah)

    - #### projectOntoElementEdge

          public static void projectOntoElementEdge(int edgeInd,
                                                    PdBary bary)

      Project the barycentric coordinates from a point to an edge of the barycentric triangle.
      Parameters:
        `edgeInd` - Target edge index.
        `bary` - Input and output point.
      Author:
        Matthias Nieser
      Version:
        16.03.07, 1.00 created (mn)

    - #### projectOntoElementSet

          public static PdBary projectOntoElementSet(PgElementSet geom,
                                                     PdVector point,
                                                     PdBary outBary)

      Project a point from R^3 to a surface. This method performs a linear run over all elements.
      Author:
        Matthias Nieser
      Version:
        14.08.2006, 1.00 created (mn)

    - #### projectOntoPolygon

          public static double projectOntoPolygon(PdVector vertex,
                                                  PgPolygon polygon,
                                                  PdBary bary2D)

      Project a vertex onto its nearest point on a given polygon. This method performs a linear run over all vertices of the polygon.
      Parameters:
        `vertex` - Vertex to project.
        `polygon` - Given polygon.
        `bary2D` - Barycentric coordinates of projected vertex will be copied here.
      Returns:
        Distance of the vertex to the polygon.
      Author:
        Matthias Nieser
      Version:
        26.11.06, 1.00 created (mn)

    - #### getOrientedAngle

          public static double getOrientedAngle(PgElementSet geom,
                                                int elemInd,
                                                PdBaryDir a,
                                                PdBaryDir b,
                                                boolean recalc)

      Oriented angle between two barycentric vectors in a triangle. User has to ensure that geometry is not null, element index is valid, a and b are not null and have size 3.
      THIS METHOD IS NOT THREAD SAFE! SIMULTANEOUS CALLS IN DIFFERENT THREADS MAY PRODUCE WEIRD RESULTS!
      Parameters:
        `geom` - underlying geometry
        `elemInd` - global element index
        `a` - first vector
        `b` - second vector
        `recalc` - used for scalar product
      Returns:
        oriented angle in [-PI, PI]; negative if `a` must be rotated against the orientation of the triangle; -3*PI if an error occurred
      See Also:
        `scalar(jv.geom.PgElementSet, int, jv.vecmath.PdBaryDir, jv.vecmath.PdBaryDir, boolean)`

    - #### getOrientedAngleAtVertex

          public static double getOrientedAngleAtVertex(PgElementSet geom,
                                                        int elemind1,
                                                        PdBaryDir dir1,
                                                        int localvertind1,
                                                        int elemind2,
                                                        PdBaryDir dir2,
                                                        int localvertind2,
                                                        boolean recalc)

      Computes the normalized angle between two barycentric vectors based at the same vertex. (The angle that the first vector must be rotated around the vertex to become the second vertex.) If vertex star is closed, the angle is a positive angle. If the vertex star is NOT closed, the sign of the returned angle tells in which direction the first vector must be rotated such that it doesn't cross the boundary of the star.

      The element indices of the two vectors must be different for this method! Use `getOrientedAngle` if this is not the case. Furthermore they must point into the element they lie on.

      HACK:
        THIS METHOD IS NOT THREAD SAFE! SIMULTANEOUS CALLS IN DIFFERENT THREADS MAY PRODUCE WEIRD RESULTS!

    - #### getOrientedAngleAtEdge

          public static double getOrientedAngleAtEdge(PgElementSet geom,
                                                      int elemind1,
                                                      PdBaryDir dir1,
                                                      int localedgeind1,
                                                      int elemind2,
                                                      PdBaryDir dir2,
                                                      int localedgeind2,
                                                      boolean recalc)

    - #### rotateInElement

          public static void rotateInElement(PgElementSet geom,
                                             int elemInd,
                                             PdBaryDir dir,
                                             double angle,
                                             PdBaryDir outdir,
                                             boolean bForceRecalc)

      Rotates direction in same orientation as the element's.
      Parameters:
        `geom` - underlying geometry
        `elemInd` - element on that vector lies
        `dir` - barycentric direction
        `angle` - rad
        `outdir` - output: result of rotation; may be same instance as dir
        `bForceRecalc` - used for scalar product
      See Also:
        `scalar(jv.geom.PgElementSet, int, jv.vecmath.PdBaryDir, jv.vecmath.PdBaryDir, boolean)`
      Version:
        26.01.00, 1.01 (ep) corrected

    - #### rotateAtVertex

          public static int rotateAtVertex(PgElementSet geom,
                                           int elemind,
                                           int localvertexind,
                                           PdBaryDir dir,
                                           PdBaryDir outdir,
                                           PdBary bary,
                                           double angle)

      Rotates direction at vertex in same orientation as the star. An angle of 2*Pi means a complete turn around the star.
      Parameters:
        `geom` - underlying geometry
        `elemind` - global element index
        `localvertexind` - local index of vertex that is base of the rotation
        `dir` - original vector
        `outdir` - output: result of rotation
        `bary` - output: barycentric coordinates of the base point of the result
        `angle` - normalized angle [0;2*PI] ^= 360°
      Returns:
        global element index where outdir lies on, or -1 if either an error occurred or rotation would be outside of element set (if vertex star is not closed)
      Version:
        21.11.00, 1.20 revised (ep) Numerical workaround added for rotation at non-closed vertices.

    - #### rotateAtEdge

          public static int rotateAtEdge(PgElementSet geom,
                                         int elem,
                                         PdBaryDir dir,
                                         int localedgeind,
                                         PdBaryDir out,
                                         PdBary pos,
                                         double angle,
                                         boolean recalc)

      Rotates a barycentric direction with base point on edge.
      Parameters:
        `geom` - underlying triangulation
        `elem` - element index of barycentric direction
        `dir` - barycentric direction with base point on element edge (pointing into element)
        `localedgeind` - local index in element of the edge the direction lies on
        `out` - output: rotated barycentric direction
        `pos` - input/output: base point is converted to new element if necessary
        `angle` - in [0;2*PI]
      Returns:
        element index of output direction

    - #### showsIntoElement

          public static boolean showsIntoElement(PdBaryDir dir,
                                                 int vertexindex)

      Checks if given barycentric vector shows into its element.
      Parameters:
        `dir` - barycentric vector that shall be checked
        `vertexindex` - local vertex index that is the base of the direction
      Returns:
        true if barycentric vector shows into its element

    - #### liesOnVertex

          public static int liesOnVertex(PdBary pos)

      Checks if given barycentric position lies within PuMath.EPS range of a vertex, and returns local index of that vertex. Method works for any dimension of barycentric coordinates.
      Parameters:
        `pos` - barycentric point, must not be null
      Returns:
        local index if pos lies close to a vertex, -1 otherwise.
      Version:
        22.10.05, 1.20 revised (kp) Extended to arbitrary dimension.
        02.12.00, 1.10 revised (kp) Check length of barycentric coordinate vector.

    - #### liesOnEdge

          public static int liesOnEdge(PdBary pos)

      Checks if given barycentric position lies within PuMath.EPS distance to the interior of an edge, and away from vertices. Returns local index of vertex opposite to edge, or -1 if position is not close to an edge.

      Method works for triangles and higher dimensional simplices only.

      Parameters:
        `pos` - barycentric position
      Returns:
        local vertex index of vertex opposite to edge, or -1 if not on edge.
      Version:
        31.05.01, 1.00 created (ep)

    - #### computeLambda

          public static double computeLambda(PdBary pos,
                                             PdBaryDir dir)

      Computes the smallest positive solution of 'pos + lambda*dir lies on boundary' for lambda. You have to ensure that pos and dir have same size and are not null. pos has to lie inside the simplex.
      Parameters:
        `pos` - Must not be null. Must have same size as dir.
        `dir` - Must not be null. Must have same size as pos.
      Returns:
        Double.POSITIVE_INFINITY if dir is zero and pos does not already lie on boundary.

    - #### getEdgeIndex

          public static int getEdgeIndex(PdBary pos)

      Checks for first occurrence of zero (i.e. `|.|< eps`) in the barycentric vector.
      Parameters:
        `pos` - must not be null
      Returns:
        -1 if point lies strictly inside or outside the simplex.

    - #### computeNormals

          public static PdBaryDir[] computeNormals(PgPolygonOnElementSet poly,
                                                   PdBaryDir[] normals,
                                                   PiVector elementind)

      TODO: DOES NOT WORK WITH CLOSED POLYGONS YET!

    - #### translatePolygonOnElementSet

          public static void translatePolygonOnElementSet(PgPolygonOnElementSet poly,
                                                          PdBaryDir[] vf,
                                                          PiVector vfInd,
                                                          PdVector distField)

      Translates the vertices of the polygon a given distance into a given direction. Note: This will produce a polygon that does no longer fully live on the element set, only the vertices are still somewhere on the element set. This makes the PolygonOnElementSet useless for most other methods that handle PolygonOnElementSets (that usually require a polygon vertex where the polygon crosses a geometry edge).
      Parameters:
        `poly` - polygon to translate
        `vf` - normalized barycentric directions for each vertex of polygon
        `vfInd` - element indices for the barycentric directions
        `distField` - the distance to move for each polygon vertex
      Version:
        21.04.07, 2.00 revised (ah) Use PnStraightestGeodesic.
        21.11.99, 1.00 created (ep)

    - #### transformBary

          public static boolean transformBary(PgElementSet geom,
                                              int origElem,
                                              PdBary origBary,
                                              int destElem,
                                              PdBary outBary)

      Tries to change a barycentric coordinate to the representation of the same space point w.r.t. a different triangle.

    - #### equalizeElementIndex

          public static int equalizeElementIndex(PgPolygonOnElementSet poly,
                                                 int index1,
                                                 int index2,
                                                 PdBary out1,
                                                 PdBary out2)

      Outputs the coordinates of two vertices on a barycentric polygon such that their barycentric coordinates refer to the same element.

      Parameters:
        `poly` - the polygon on a triangulation
        `index1` - first point (index in poly)
        `index2` - second point (index in poly)
      Returns:
        common element index or -1
      Version:
        16.02.05, 1.20 created (ep) Created from vgp.curve.subdivision.PjSubdivisionCurve.
        04.06.04, 1.10 revised (ep) Removed bug with ending triangle runs and at least one bary on vertex.

    - #### changeBarycentricOnEdge

          public static void changeBarycentricOnEdge(PdBary inOut,
                                                     int locind1,
                                                     int locind2)

      Switch to barycentric coordinates that represent same point on edge wrt the other element adjacent to edge. Only triangles. This method does not test, if the neighbour element exists and also does not adapt the element index of inOut.
      Parameters:
        `inOut` - must have a zero at locind1, result is put here
        `locind1` - local index of edge in origin triangle
        `locind2` - local index of edge in destination triangle
      Version:
        16.02.05, 1.20 created (ep) Created from vgp.curve.subdivision.PjSubdivisionCurve.

    - #### changeBarycentricOnEdge

          public static int changeBarycentricOnEdge(PgElementSet geom,
                                                    PdBary inoutBary,
                                                    int locInd)

      A given point in element e will be projected to an adjacent edge and its barycentric coordinates in the neighbour triangle is returned.

      This method works differently than changeBarycentricOnEdge(PdBary, int, int), since it also handles the case if the two elements are differently oriented. Furthermore, the elementInd will be set to the new element.

      Parameters:
        `geom` - A geometry.
        `inoutBary` - Barycentric coordinates of a point on the surface.
        `locInd` - Local edge index for the current element (inoutBary.getElementInd()).
      Returns:
        Local index of the edge resp neighbour element or -1 if surface boundary has been reached.
      Author:
        Matthias Nieser
      Version:
        04.07.07, 1.40 revised (mn) Local edge index of neighbour element returned.
        19.03.07, 1.30 revised (mn) Project point onto edge.
        14.03.07, 1.20 revised (mn) Added boolean return value.
        18.10.06, 1.10 revised (mn) Moved to PwBary.

    - #### changeBarycentricOnEdge

          public static boolean changeBarycentricOnEdge(PgElementSet geom,
                                                        PdBaryDir baryDir,
                                                        int locInd)

      Changes the barycentric representation of a vector in an element with respect to a neighbour element.
      Parameters:
        `geom` - Given element set.
        `baryDir` - Barycentric coordinates of a vector on the geometry. Used for input and output.
        `locInd` - Local neighbour index for an incident element. The barycentric coordinates will be rewritten with respect to this neighbour element.
      Author:
        Matthias Nieser
      Version:
        27.03.07, 1.10 revised (mn) Moved to PwBary.

    - #### getBaryDescriptions

          public static PdBary[] getBaryDescriptions(PgElementSet geom,
                                                     PdBary bary,
                                                     double eps)

      Get the barycentric coordinates of a given point in all elements, which contains this point. (2, if it lies on an edge, more if it lies on a vertex).
      Parameters:
        `geom` - A geometry.
        `bary` - Barycentric coordinates of a point on geom.
        `eps` - Accuracy of the calculation. Points with a distance of < eps to a vertex/edge will be treated as lying on that vertex/edge.
      Returns:
        Barycentric coordinates of the given point with respect to all incident elements.
      Author:
        Matthias Nieser
      Version:
        16.10.06, 1.10 revised (mn) Moved to PwBary.

    - #### makeBaryDescription

          public static boolean makeBaryDescription(PgElementSet geom,
                                                    PdBary bary,
                                                    int newElement,
                                                    double eps)

      Try to make a barycentric description of a point w.r.t. a specidied element in the geometry.
      Parameters:
        `geom` - Input geometry.
        `bary` - Barycentric point on geom. If possible, the new barycentric coordinates will be copied here.
        `newElement` - New element index.
        `eps` - Epsilon tolerance.
      Returns:
        True, if bary can be expressed w.r.t. the new element.
      Author:
        Matthias Nieser
      Version:
        09.01.08, 1.00 created (mn)

    - #### makeCommonBaryDescription

          public static boolean makeCommonBaryDescription(PgElementSet geom,
                                                          PdBary bary1,
                                                          PdBary bary2,
                                                          double eps)

      Convert the barycentric coordinates of two points on a surface, such that they are described w.r.t. the same triangle of the surface. If this is possible, the input coordinates will be changed to that representation.
      Parameters:
        `geom` - Underlying surface.
        `bary1` - First point.
        `bary2` - Second point.
        `eps` - Accuracy of the test if a point lies on an edge.
      Returns:
        True, if the points could be represented w.r.t. the same triangle.
      Author:
        Matthias Nieser
      Version:
        13.6.07, 1.10 revised (mn) By multiples possibilities, try to leave one element index.
        8.6.07, 1.00 created (mn)

    - #### getVertex

          public static PdVector getVertex(PdVector vertex,
                                           PgElementSet geom,
                                           PdBary bary)

      Get the coordinates of a vertex from its barycentric coordinates.
      Parameters:
        `vertex` - Output vector for the coordinates of the point. May be null.
        `geom` - Given geometry.
        `bary` - Barycentric coordinates of the point on the geometry.
      Returns:
        either argument vertex, or newly created vertex if argument was null.
      Version:
        18.10.06, 1.10 revised (mn) Added error handling. Vertex may now be null.

    - #### getVertex

          public static PdVector getVertex(PdVector vertex,
                                           PgPolygon polygon,
                                           PdBary bary)

      Get vertex from barycentric coordinates on a polygon.
      Parameters:
        `vertex` - Output vector for the coordinates of the point. May be null.
        `polygon` - Given polygon.
        `bary` - Barycentric coordinates. Must be of dimension 2.
      Returns:
        either argument vertex, or newly created vertex if argument was null.
      Version:
        26.11.06, 1.00 created (mn)

    - #### getVector

          public static PdVector getVector(PdVector dir,
                                           PgElementSet geom,
                                           PdBaryDir baryDir)

      Get the coordinates of a vector from its barycentric coordinates.
      Parameters:
        `dir` - Output direction for the coordinates of the vector. May be null.
        `geom` - Geometry.
        `baryDir` - Barycentric coordinates of the vector on the geometry.
      Returns:
        either argument vector, or newly created vector if argument was null.
      Version:
        29.01.07, 1.00 created (mn)

    - #### newVertexBary

          public static PdBary newVertexBary(int element,
                                             int locVertInd)

      Make a new PdBary instance representing a vertex on the given element set.
      Parameters:
        `element` - Element index in the element set.
        `locVertInd` - Local vertex index of the vertex in the element.
      Returns:
        A new PdBary representing the vertex.
      Version:
        10.07.07, 1.10 revised (mn) Moved to PwBary.
        xx.xx.07, 1.00 created (mn)

    - #### subBary

          public static PdBaryDir subBary(PgElementSet geom,
                                          PdBary b1,
                                          PdBary b2,
                                          PdBaryDir outDir)

      Substract two points on a surface in barycentric coordinates. The two points must lie in the same triangle or on an edge or vertex, such that they can be written w.r.t. the same triangle.
      Author:
        Matthias Nieser
      Version:
        12.07.07, 1.00 created (mn)

    - #### vertexToBary

          public static PdBary vertexToBary(PgElementSet geom,
                                            int vertex,
                                            int neighbourElement)

      Create barycentric coordinates of a given vertex in a PgElementSet.

"

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