jvx.geom

## Class PwCleanMesh

- java.lang.Object
- - jv.object.PsObject
  - - jvx.project.PjWorkshop
    - - jvx.geom.PwCleanMesh

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PjWorkshopIf

      public class PwCleanMesh
      extends PjWorkshop

  Utility programs for cleaning and correcting a polyhedral mesh. Contains static functions to operate on a PgElementSet.

  Identification of vertices incorporated into loader manager jv.loader.PgLoader. Therefore functionality to identify vertices moved from jvx.geom.PwCleanMesh to jv.geom.PuCleanMesh.

  See Also:
    Serialized Form
  Author:
    Konrad Polthier, Ulrich Reitebuch, Matthias Nieser
  Version:
    22.12.09, 4.20 revised (ur) Added several mesh modification methods.
    07.04.08, 4.10 revised (fk) Edge support in makeOrientation. Inlined local variables.
    09.10.07, 4.00 revised (mn) Moved "identify vertices" to PwIdentify and implemented new clean mesh workshop.
    27.06.07, 3.30 revised (ur) Some methods changed from protected to public.
    22.09.06, 3.20 revised (ur) New methods to repair non-manifold situations are added.
    01.01.04, 3.10 revised (kp) New methods regarding number of components.
    06.10.03, 3.00 revised (kp) Functionality for identification of vertices moved to jv.geom.PuCleanMesh.
    08.05.02, 2.40 revised (ur) New methods to handle parameter lines added.
    02.05.02, 2.30 revised (kp) Working implementation of new method to identify flat vertex stars.
    08.04.02, 2.20 revised (ur) PgElementSet boundary methods moved from PwCleanMesh to PwBoundary.
    14.02.02, 2.10 revised (ur) New Method to make Boundary Constraints.
    07.02.02, 2.00 revised (ur) PwCleanMesh now extends PjWorkshop.
    IdentifyVertices and removeDegenerateElements maintain neighbourhoods.
    21.12.01, 1.90 revised (ur) Identify Vertices enabled for PointSet, Polygon and PolygonSet.
    19.11.01, 1.80 revised (ur) Three new methods added.
    06.06.01, 1.70 revised (ur) RemoveDegenerateElements method improved.
    02.02.01, 1.60 revised (ur) New Method orientate(PgElementSet) added.
    13.12.00, 1.50 revised (ur) Methods markVertices and removeMarks added.
    21.11.00, 1.40 revised (ur) Added method getDialog().
    21.11.00, 1.30 revised (ep) Added method isDegenerated(PgElementSet).
    15.06.00, 1.20 revised (kp) Added method identifyVertices().
    27.04.00, 1.10 revised (kp) Method adapt() moved from PgElementSet into this workshop.
    25.01.00, 1.00 created (ur)

- - ### Field Summary

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

    - ### Fields inherited from interface jv.project.PjWorkshopIf

      `MODE_BUG, MODE_STANDARD, MODE_VALIDATE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PwCleanMesh(java.lang.String name)` Construct a new PwCleanMesh.
    `PwCleanMesh(java.lang.String name, PgElementSet geom)` Construct a new PwCleanMesh from a given geometry.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `centralSplit(PgElementSet geom, int elIndex)` Split a single element of a PgElementSet into triangles by inserting a center vertex.
    `static void` | `centralSplitSelectedElements(PgElementSet geom)` Split all selected elements by inserting center vertices.
    `static boolean` | `checkManifold(PgElementSet geom, boolean bMessage)` Check if a given element set is a 2D manifold.
    `static void` | `cleanMesh(PgElementSet geom, boolean identifyVertices, boolean triangulate, boolean removeDegeneratedElements, boolean removeDuplicateElements, boolean removeUnusedVertices, boolean makeManifold, boolean removeOverlaps)` Cleans a given element set.
    `static void` | `closeHoles(PgElementSet geom)` Close all holes in a geometry by the triangles that are generated by the triangulation of boundary polygons.
    `static int` | `collapseEdge(PgElementSet geom, int elementIndex, int localIndex)` Collapse a single edge in a PgElementSet.
    `static void` | `collapseEdges(PgElementSet geom, double eps)` Collapse all edges which are shorter than some epsilon.
    `static void` | `collapseEdgesBetweenSelectedElements(PgElementSet geom)` Collapse edges between pairs of selected elements - elements will be unselected, so no element will be collapsed at more than one edge.
    `static int` | `computeConnectivityComponents(PgElementSet geom, PiVector compInd)` Compute the connectivity components of a surface.
    `static PdVector` | `computeElementNormal(PdVector[] vertex)` Compute normal of an element, given by its vertices in cyclic order.
    `static void` | `computeElementNormal(PgElementSet geom, int elementIndex)` Compute an element normal anew.
    `static void` | `cutAlongPolygonSet(PgElementSet geom, PgPolygonSet polygonSet)` Cut a surface along polygons consisting of element edges, duplicate all vertices along this polygons, and set the polygons as additional boundary polygons.
    `static void` | `flipEdge(PgElementSet geom, int elementIndex, int localIndex)` Flip a single edge of a PgElementSet.
    `static void` | `flipEdgesBetweenSelectedElements(PgElementSet geom)` Flip edges between pairs of selected elements - elements will be unselected, so no element will be flipped at more than one edge.
    `static void` | `flipOrientationOfElement(PgElementSet geom, int index)` Flip orientation of a single element.
    `static void` | `flipOrientationSelectedElements(PgElementSet geom)` Flip orientation of all elements tagged by PsObject.IS_SELECTED.
    `java.lang.String` | `getName()` Get the name of the workshop.
    `static int` | `getNumComponents(PgElementSet geom)` Get number of connectivity components.
    `static int` | `getNumNeighbourhoodDegenerations(PgElementSet geom)` Count pairs of elements, which have common vertices, which are not connected by a common edge.
    `static int` | `getNumNonManifoldEdges(PgElementSet geom)` Count non-manifold edges contained in the geometry.
    `static int` | `getNumNonManifoldVertices(PgElementSet geom)` Count vertices with more than one coherent link of adjacent elements.
    `static PgPolygonSet` | `getParameterLines(PgElementSet geom)` Deprecated. method is moved to PwParameterLines.
    `static boolean` | `hasPlanarElements(PgElementSet geom, double eps)` Test if faces of geometry are planar.
    `static int[]` | `identifyEqualElements(PgElementSet geom)` Identify and remove (combinatorially) equal elements.
    `static int` | `identifyFlatEdges(PgElementSet geom, double eps)` Deprecated. since JavaView 3.99.003, use PwIdentify.identifyFlatEdges(PgElementSet, double) instead.
    `static int` | `identifyFlatRegions(PgElementSet geom, double eps)` Deprecated. since JavaView 3.99.003, use PwIdentify.identifyFlatRegions(PgElementSet, double) instead.
    `static void` | `identifyMarkedVertices(PgElementSet elementSet)` Identify Selected Vertices, the position of the new vertex will be averaged from the identified vertices.
    `static int` | `identifyVertices(PgPointSet geom, double eps)` Deprecated. starting with JavaView 2.99.018 this functionality is provided by jv.geom.PuCleanMesh#identifiyVertices(PgPointSet, double).
    `void` | `init()` Initializes the workshop.
    `static boolean` | `isDegenerated(PgElementSet geom)` Checks whether edges of elements have length smaller than PuMath.EPS.
    `static boolean` | `isOrientatable(PgElementSet geom)` Check orientability of PgElementSet.
    `static void` | `joinElements(PgElementSet elementSet, int index, int localIndex)` Join two elements.
    `static void` | `joinPolygons(PgPolygonSet polygonSet)` Join polygons of a polygon set to new polygons.
    `static void` | `makeManifold(PgElementSet geom)` Adapts the given input surface to be manifold, i.e. the stars of all vertices become topological disks.
    `static boolean` | `makeOrientation(PgElementSet geom)` Try to generate a consistent orientation all elements of the PgElementSet according to the orientation of all their neighbour elements.
    `void` | `markBoundaryEndPoints()` Mark all start and end vertices of a PgElementSets boundary Polygons with the tag PsObject.IS_SELECTED.
    `static void` | `markBoundaryEndPoints(PgElementSet geom)` Mark all start and end vertices of a PgElementSets boundary Polygons with the tag PsObject.IS_SELECTED.
    `void` | `markCornerVertices(double angle)` Search in a PgElementSet for boundary vertices with surface angle less than a threshold value (in degrees) and mark those with the tag PsObject.IS_SELECTED.
    `static void` | `markCornerVertices(PgElementSet geom, double angle)` Search in a PgElementSet for boundary vertices with surface angle less than a threshold value (in degrees) and mark those with the tag PsObject.IS_SELECTED.
    `static int` | `markFlatEdges(PgElementSet geom, double eps)` Deprecated. since JavaView 3.99.003, use PwIdentify.markFlatEdges(PgElementSet, double) instead.
    `static int` | `markFlatRegions(PgElementSet geom, double eps)` Deprecated. since JavaView 3.99.003, use PwIdentify.markFlatRegions(PgElementSet, double) instead.
    `void` | `markVertices(double eps)` Deprecated. since JavaView 3.99.003, use PwIdentify.markVertices(double) instead.
    `static void` | `markVertices(PgPointSet geom, double eps)` Deprecated. since JavaView 3.99.003, use PwIdentify.markVertices(PgPointSet, double) instead.
    `static void` | `mergeSelectedElements(PgElementSet geom)` Merge pairs of neighbouring selected elements.
    `static void` | `orientate(PgElementSet geom)` Deprecated. JavaView 3.97.051, use makeOrientation(PgElementSet) instead.
    `static void` | `refineParameterLines(PgElementSet geom, int grade)` Deprecated. method is moved to PwParameterLines.
    `static void` | `removeDegenerateElements(PgElementSet geom)` Deprecated. starting with JavaView 2.99.018 this functionality is provided by jv.geom.PuCleanMesh#removeDegenerateElements(PgElementSet).
    `static boolean` | `removeHangingNodes(PgElementSet geom)` Remove hanging nodes: Find adjacent boundary edges with opposite direction and insert the not common end point of the shorter edge upon the longer edge, split the resp. face.
    `static boolean` | `removeHangingNodes(PgElementSet geom, double maxAngle, boolean splitElements)` Remove hanging nodes: Find adjacent boundary edges with opposite direction and insert the not common end point of the shorter edge upon the longer edge, split the resp. face.
    `void` | `removeMarks()` Deprecated. since JavaView 3.99.003, use PwIdentify.removeMarks() instead.
    `static void` | `removeMarks(PgGeometry geom)` Deprecated. since JavaView 3.99.003, use PwIdentify.removeMarks(PgGeometry) instead.
    `static int` | `removeNeighbourhoodDegenerations(PgElementSet geom)` Detect pairs of elements, which have common vertices, which are not connected by a common edge.
    `static void` | `removeNonManifoldEdges(PgElementSet geom)` Remove non-manifold edges from the geometry.
    `static void` | `removeSelectedVerticesAndFill(PgElementSet elementSet)` Remove all selected vertices and fill the holes by new elements given by the neighbouring vertices.
    `static void` | `removeSmallAngles(PgElementSet geom, double eps, boolean bRemove)` Clean mesh from small angles i.e. flip edges opposite to angles close to `PI`, collapse edges opposite of angles close to 0.
    `static void` | `removeValence3Vertices(PgElementSet elementSet)` Valence 3 vertices are removed by edge collapse.
    `static void` | `removeVertexAndFill(PgElementSet elementSet, int index, int elIndex)` Remove a vertex and fill the hole by a new element given by all neighbouring vertices.
    `static void` | `resamplePolygon(PgPolygon polygon, int numSamples)` Uniformly resample a PgPolygon.
    `void` | `reset()` Reset the geometry.
    `static void` | `rotateStar(PgElementSet elementSet, int index, int elIndex)` Rotate a vertex star - each edge connecting the center vertex to a vertex in the link will be moved to the next vertex in the vertex star's boundary.
    `static void` | `rotateStarsSelectedVertices(PgElementSet elementSet)` Rotate Vertex stars of all vertices tagged by PsObject.IS_SELECTED.
    `static void` | `scrambleElements(PgElementSet elementSet)` Change the internal order of indices of the vertices in all triangles by random to get arbitrary examples for testing the algorithm.
    `void` | `setDisplay(PvDisplayIf display)` Set the active display when this workshop was launched.
    `void` | `setGeometry(PgGeometry geom)` Set the geometry.
    `static PgElementSet` | `splitBySelection(PgElementSet geom)` Split a surface into selected and not selected part.
    `static void` | `splitCurvedPolygons(PgPolygonSet polySet, double threshold)` Split polygons, until all polygons satisfy a straghtness criterion: All interiour vertices are sorted by their distance to the straight line between start and end point.
    `static void` | `splitElement(PgElementSet geom, int elIndex, int locInd0, int locInd1)` Split a single element of a PgElementSet into two elements.
    `static void` | `splitElement(PgElementSet geom, int elIndex, int locInd0, int locInd1, boolean splitNeighbours)` Split a single element of a PgElementSet into two elements.
    `static void` | `splitElementsByVertexSelection(PgElementSet geom)` Split elements by inserting edges between selected vertices.
    `static PgElementSet[]` | `splitIntoComponents(PgElementSet geom)` Split a surface into a set of connectivity components.
    `static PiVector` | `splitNonManifoldVertices(PgElementSet geom)` Search for vertices with more than one coherent link of adjacent elements and disconnect those to good discrete manifold vertices, each belonging to one of the element links.
    `void` | `start()` Start mesh cleaning.
    `boolean` | `update(java.lang.Object event)` Update the class whenever a child has changed.

    - ### Methods inherited from class jvx.project.PjWorkshop

      `cancel, close, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, removeGeometry, setDisplays, setModal, setMode, setStandalone, setViewer`

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels`

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

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

    - ### Methods inherited from interface jv.object.PsUpdateIf

      `getFather, setParent`

- - ### Constructor Detail

    - #### PwCleanMesh

          public PwCleanMesh(java.lang.String name)

      Construct a new PwCleanMesh.
      Parameters:
        `name` - Name of the workshop.

    - #### PwCleanMesh

          public PwCleanMesh(java.lang.String name,
                             PgElementSet geom)

      Construct a new PwCleanMesh from a given geometry.
      Parameters:
        `name` - Name of the workshop.
        `geom` - Geometry to work on.

  - ### Method Detail

    - #### init

          public void init()

      Initializes the workshop.
      Overrides:
        `init` in class `PjWorkshop`

    - #### setGeometry

          public void setGeometry(PgGeometry geom)

      Set the geometry.
      Specified by:
        `setGeometry` in interface `PjWorkshopIf`
      Overrides:
        `setGeometry` in class `PjWorkshop`
      Parameters:
        `geom` - the workshop modifies this geometry.

    - #### setDisplay

          public void setDisplay(PvDisplayIf display)

      Set the active display when this workshop was launched.
      Specified by:
        `setDisplay` in interface `PjWorkshopIf`
      Overrides:
        `setDisplay` in class `PjWorkshop`

    - #### reset

          public void reset()

      Reset the geometry. This method will copy the original surface back.
      Overrides:
        `reset` in class `PjWorkshop`

    - #### update

          public boolean update(java.lang.Object event)

      Update the class whenever a child has changed. Method is usually invoked from the children.
      Specified by:
        `update` in interface `PsUpdateIf`
      Overrides:
        `update` in class `PjWorkshop`
      Parameters:
        `event` - sender of this update.
      Returns:
        true if update was correctly handled by superclass.
      See Also:
        `PsObject.setParent(PsUpdateIf)`, `PsObject.getFather()`, `PsObject.addUpdateListener(PsUpdateIf)`

    - #### getName

          public java.lang.String getName()

      Get the name of the workshop.
      Specified by:
        `getName` in interface `PsUpdateIf`
      Overrides:
        `getName` in class `PsObject`

    - #### start

          public void start()

      Start mesh cleaning.
      Author:
        Matthias Nieser
      Version:
        09.10.07, 1.00 created (mn)

    - #### cleanMesh

          public static void cleanMesh(PgElementSet geom,
                                       boolean identifyVertices,
                                       boolean triangulate,
                                       boolean removeDegeneratedElements,
                                       boolean removeDuplicateElements,
                                       boolean removeUnusedVertices,
                                       boolean makeManifold,
                                       boolean removeOverlaps)

      Cleans a given element set.
      Author:
        Matthias Nieser
      Version:
        09.10.07, 1.00 created (mn)

    - #### markFlatEdges

          public static int markFlatEdges(PgElementSet geom,
                                          double eps)

      Deprecated. since JavaView 3.99.003, use PwIdentify.markFlatEdges(PgElementSet, double) instead.

    - #### identifyFlatEdges

          public static int identifyFlatEdges(PgElementSet geom,
                                              double eps)

      Deprecated. since JavaView 3.99.003, use PwIdentify.identifyFlatEdges(PgElementSet, double) instead.

    - #### identifyFlatRegions

          public static int identifyFlatRegions(PgElementSet geom,
                                                double eps)

      Deprecated. since JavaView 3.99.003, use PwIdentify.identifyFlatRegions(PgElementSet, double) instead.

    - #### markFlatRegions

          public static int markFlatRegions(PgElementSet geom,
                                            double eps)

      Deprecated. since JavaView 3.99.003, use PwIdentify.markFlatRegions(PgElementSet, double) instead.

    - #### identifyVertices

          public static int identifyVertices(PgPointSet geom,
                                             double eps)

      Deprecated. starting with JavaView 2.99.018 this functionality is provided by jv.geom.PuCleanMesh#identifiyVertices(PgPointSet, double).
      Identify vertices which are identical, or within an epsilon box of each other. Vertices are first sorted along the diagonal of the bounding box to accelerate the comparison.
      Parameters:
        `geom` - Geometry whose vertices shall be identified
        `eps` - tolerance of coordinate components, not distance
      Returns:
        number of removed vertices
      Author:
        Konrad Polthier
      Version:
        14.05.03, 1.90 revised (ur) For 2d geometry assure dimension of bounding box diagonal.
        20.03.03, 1.80 revised (ep) Check for (numVertices < 2).
        19.05.02, 1.70 revised (kp) Sort vertices first along diagonal of bounding box.
        20.12.01, 1.60 revised (ur) Extended to handle different types of geometries.
        01.03.01, 1.50 revised (kp) Use heapsort to reduce complexity of method.
        15.06.00, 1.00 created (kp)

    - #### markVertices

          public void markVertices(double eps)

      Deprecated. since JavaView 3.99.003, use PwIdentify.markVertices(double) instead.

    - #### markVertices

          public static void markVertices(PgPointSet geom,
                                          double eps)

      Deprecated. since JavaView 3.99.003, use PwIdentify.markVertices(PgPointSet, double) instead.

    - #### removeMarks

          public void removeMarks()

      Deprecated. since JavaView 3.99.003, use PwIdentify.removeMarks() instead.

    - #### removeMarks

          public static void removeMarks(PgGeometry geom)

      Deprecated. since JavaView 3.99.003, use PwIdentify.removeMarks(PgGeometry) instead.

    - #### removeDegenerateElements

          public static void removeDegenerateElements(PgElementSet geom)

      Deprecated. starting with JavaView 2.99.018 this functionality is provided by jv.geom.PuCleanMesh#removeDegenerateElements(PgElementSet).
      Adapt triangulation to the following conventions: - the vertices of an element must be pairwise different. - every element has at least three vertices.
      Author:
        Ulrich Reitebuch
      Version:
        30.01.02, 1.20 revised (ur) Maintain neighbourhood informations.
        06.06.01, 1.10 revised (ur) Divide elements with not subsequent equal vertices.
        25.01.00, 1.00 created (ur)

    - #### isDegenerated

          public static boolean isDegenerated(PgElementSet geom)

      Checks whether edges of elements have length smaller than PuMath.EPS.
      See Also:
        `PuMath`
      Version:
        30.04.02, 1.20 revised (ur) Compute vertex check for edges with neighbour index lower than element index.
        01.03.01, 1.10 revised (kp) Copying of vectors replaced with assignment.
        21.11.00, 1.00 created (ep)

    - #### collapseEdges

          public static void collapseEdges(PgElementSet geom,
                                           double eps)

      Collapse all edges which are shorter than some epsilon. Occurrence of second vertex of a collapsed edge is replaced with first vertex in the vertex star of the second vertex.
      Parameters:
        `eps` - All edges with length smaller than eps are collapsed.
      Author:
        Ulrich Reitebuch
      Version:
        02.04.14, 3.00 revised (ur) rewritten using collapseEdge, more security checks.
        04.06.07, 2.01 revised (fk) Simplified.
        01.01.04, 2.00 revised (kp) Renamed to collapseEdges() from identifyNeighbouredVertices().
        01.01.04, 1.10 revised (kp) Code optimization.
        26.04.02, 1.00 created (ur)

    - #### identifyEqualElements

          public static int[] identifyEqualElements(PgElementSet geom)

      Identify and remove (combinatorially) equal elements. Two elements are identical if they refer the same vertex indices.
      Returns:
        Array with indices of new positions of all previously existing elements
      Author:
        Ulrich Reitebuch
      Version:
        20.05.10, 1.10 revised (mn) Add return value.
        07.03.02, 1.00 created (ur)

    - #### orientate

          public static void orientate(PgElementSet geom)

      Deprecated. JavaView 3.97.051, use makeOrientation(PgElementSet) instead.
      Try to orient all elements of the PgElementSet according to the orientation of all their neighbour elements. This will obviously lead to a success only for orientable surfaces.
      Author:
        Ulrich Reitebuch
      Version:
        19.10.06, 2.10 revised (ur) Bug fixed: inverted neighbour PiVectors must be shifted by -3.
        05.10.05, 2.00 revised (kp) Avoid internal cloning, and adjust element texture as well.
        01.01.04, 1.10 revised (kp) Code optimization.
        02.02.01, 1.00 created (ur)

    - #### makeOrientation

          public static boolean makeOrientation(PgElementSet geom)

      Try to generate a consistent orientation all elements of the PgElementSet according to the orientation of all their neighbour elements. This will obviously lead to a success only for orientable surfaces.
      Returns:
        `true`, if surface could be successfully oriented
      Since:
        JavaView 3.97.051, renamed from previous orientate().
      Author:
        Ulrich Reitebuch
      Version:
        07.04.08, 3.10 revised (fk) Update edge stars as well.
        13.02.07, 3.00 revised (kp) Renamed to makeOrientation() from previous name orientate().
        19.10.06, 2.10 revised (ur) Bug fixed: inverted neighbour PiVectors must be shifted by -3.
        05.10.05, 2.00 revised (kp) Avoid internal cloning, and adjust element texture as well.
        01.01.04, 1.10 revised (kp) Code optimization.
        02.02.01, 1.00 created (ur)

    - #### isOrientatable

          public static boolean isOrientatable(PgElementSet geom)

      Check orientability of PgElementSet.
      Returns:
        `true`, if surface is orientable.
      Since:
        JavaView 3.97.052.
      Author:
        Ulrich Reitebuch
      Version:
        14.02.07, 1.00 created (ur)

    - #### getNumComponents

          public static int getNumComponents(PgElementSet geom)

      Get number of connectivity components.
      Author:
        Konrad Polthier
      Version:
        01.01.04, 1.00 created (kp)

    - #### computeConnectivityComponents

          public static int computeConnectivityComponents(PgElementSet geom,
                                                          PiVector compInd)

      Compute the connectivity components of a surface. Method fills an array with the index of the component for each element of the surface. The elements are indexed with numbers in [0, numComponents-1].
      Parameters:
        `compInd` - Filled with component index for each element, may be null.
      Returns:
        Number of connectivity components
      Author:
        Ulrich Reitebuch, Konrad Polthier
      Version:
        10.10.07, 2.10 revised (ur) Bug fixed (loop exit criterion was not correct).
        05.10.05, 2.00 revised (kp) Full optimization and sync'ed with other orientate().
        01.01.04, 1.00 created (kp) Extracted and modified from splitIntoComponents().

    - #### splitBySelection

          public static PgElementSet splitBySelection(PgElementSet geom)

      Split a surface into selected and not selected part. All selected elements, identified by a tag

           geom.hasTagElement(i, PsObject.IS_SELECTED)

      are removed from the original geometry and added to the new returned geometry.

      Currently, all unused vertices remain in original geometry. The new returned geometry contains only used vertices.

      Returns:
        element set containing all selected elements.
      Author:
        Ulrich Reitebuch, Konrad Polthier
      Version:
        14.02.14, 3.00 revised (ur) Bugfix: Remove "IS_DELETED" tags in copy.
        26.04.13, 2.00 revised (kp) Rewritten using copySelect method, copy of all properties, no cloning.
        12.12.08, 1.00 created (ur)

    - #### splitIntoComponents

          public static PgElementSet[] splitIntoComponents(PgElementSet geom)

      Split a surface into a set of connectivity components.
      Returns:
        Array of components as individual element sets.
      Author:
        Ulrich Reitebuch, Konrad Polthier
      Version:
        26.04.13, 5.00 revised (kp) Rewritten using copySelect method, copy of all properties, no cloning.
        01.12.08, 4.00 revised (ur) Original state (repeated cloning of geometry) restored.
        13.11.07, 3.00 created (mn) Totally rewritten.
        01.01.04, 2.00 revised (kp) Major speed improvements, avoid repeated cloning of original geometry.
        26.03.01, 1.00 created (ur)

    - #### joinPolygons

          public static void joinPolygons(PgPolygonSet polygonSet)

      Join polygons of a polygon set to new polygons. The new polygons will not have ending points of other polygons as inner points and inner points will not have the tag PsObject.IS_SELECTED, and at no vertex will be exactly two ends of polygons, except the ends of a closed polygon.
      Author:
        Ulrich Reitebuch
      Version:
        15.03.02, 1.10 revised (ur) Handle polygon colors.
        03.07.01, 1.00 created (ur)

    - #### getNumNonManifoldVertices

          public static int getNumNonManifoldVertices(PgElementSet geom)

      Count vertices with more than one coherent link of adjacent elements. This method requires correct neighbourhood information.
      Author:
        Ulrich Reitebuch
      Version:
        18.10.06, 1.00 created (ur)

    - #### makeManifold

          public static void makeManifold(PgElementSet geom)

      Adapts the given input surface to be manifold, i.e. the stars of all vertices become topological disks.

      This is the order of actions, in which all degenerations should disappear:
      [1] remove element degenerations:
      - every element will have at least three vertices, the vertices of an element are pairwise distinct. When this is done, element - edge incidences are well defined.
      [2] remove non-manifold edges:
      - every edge is edge of exactly two elements (then it is an interior edge) or of exactly one element (then it is a boundary edge).
      [3] compute neighbourhood.
      - after [1] and [2], all edges of elements are o.k., each edge is incident to one element or to two distinct elements; so the PgElementSet.makeNeighbour() method will produce intact neighbourhood information.
      [4] split non-manifold vertices:
      - each vertex will be contained in exactly one ring-neighbourhood of faces (may be open or closed) or it is an unused vertex. this method needs correct neighbourhood information, since it runs on PgVertexStar.
      [5] remove neighbourhood degenerations:
      - a pair of adjacent elements will have exactly two common vertices (the end points of the unique common edge), other pairs of elements may have at most one common vertex. This method needs correct neighbourhood information, since it also runs on PgVertexStar.

      Author:
        Ulrich Reitebuch
      Version:
        10.10.07, 1.00 created (mn) Copied from dev menu.

    - #### splitNonManifoldVertices

          public static PiVector splitNonManifoldVertices(PgElementSet geom)

      Search for vertices with more than one coherent link of adjacent elements and disconnect those to good discrete manifold vertices, each belonging to one of the element links. This method requires correct neighbourhood information.
      Returns:
        PiVector containing the index map new vertex index to old vertex index.
      Author:
        Ulrich Reitebuch
      Version:
        17.03.10, 1.30 revised (ur) return vertex index vector.
        18.10.06, 1.20 revised (ur) method is renamed; previous name: makeManifold.
        13.06.02, 1.10 revised (ur) improved to a linear method, boundary handling added.
        23.01.02, 1.00 created (ur)

    - #### markBoundaryEndPoints

          public void markBoundaryEndPoints()

      Mark all start and end vertices of a PgElementSets boundary Polygons with the tag PsObject.IS_SELECTED. This is a non-static call for PjWorkshop use.

    - #### markBoundaryEndPoints

          public static void markBoundaryEndPoints(PgElementSet geom)

      Mark all start and end vertices of a PgElementSets boundary Polygons with the tag PsObject.IS_SELECTED.

    - #### markCornerVertices

          public void markCornerVertices(double angle)

      Search in a PgElementSet for boundary vertices with surface angle less than a threshold value (in degrees) and mark those with the tag PsObject.IS_SELECTED. Vertices already marked get not unmarked. This is a non-static call for PjWorkshop use.

    - #### markCornerVertices

          public static void markCornerVertices(PgElementSet geom,
                                                double angle)

      Search in a PgElementSet for boundary vertices with surface angle less than a threshold value (in degrees) and mark those with the tag PsObject.IS_SELECTED. Vertices already marked get not unmarked.
      Author:
        Ulrich Reitebuch
      Version:
        02.08.08, 1.30 revised (kp) Flip of vertices in angle calculation corrected, was introduced rev by fk in feb 08.
        23.01.02, 1.20 revised (ur) Moved from PwSimplify to PwCleanMesh.
        29.12.01, 1.10 revised (kp) Update of geometry removed at the end of this methods.
        15.02.00, 1.00 created (ur)

    - #### hasPlanarElements

          public static boolean hasPlanarElements(PgElementSet geom,
                                                  double eps)

      Test if faces of geometry are planar.
      Author:
        Klaus Hildebrandt
      Version:
        28.11.03, 1.01 revised (kp) Return true if `dimOfVertices<=2`.
        29.01.02, 1.00 created (kh)

    - #### getParameterLines

          public static PgPolygonSet getParameterLines(PgElementSet geom)

      Deprecated. method is moved to PwParameterLines.
      Get parameter lines of a PgElementSet, extracted from its combinational properties, as a new PgPolygonSet. Existing boundary polygons are used as parameter lines along the boundary; if no boundary polygons exist, all boundary edges are returned as parameter lines of only one single edge.
      Author:
        Ulrich Reitebuch
      Version:
        21.10.03, 1.10 revised (ur) method moved to PwParameterLines. 03.05.02, 1.00 created (ur)

    - #### refineParameterLines

          public static void refineParameterLines(PgElementSet geom,
                                                  int grade)

      Deprecated. method is moved to PwParameterLines.
      Refine the parameter lines of an PgElementSet by DLG refinement. Attention, the PgElementSet will have bad neighbourhood properties afterwards: If an edge gets refined, the adjacent elements will have each other as neighbours more than once.
      Author:
        Ulrich Reitebuch
      Version:
        21.10.03, 1.20 revised (ur) method moved to PwParameterLines. 19.06.02, 1.10 revised (ur) Added handling of element textures.
        06.05.02, 1.00 created (ur)

    - #### cutAlongPolygonSet

          public static void cutAlongPolygonSet(PgElementSet geom,
                                                PgPolygonSet polygonSet)

      Cut a surface along polygons consisting of element edges, duplicate all vertices along this polygons, and set the polygons as additional boundary polygons.

      HACK: Method expects the polygonSet indices to be the indices of elementSet vertices...

      Author:
        Ulrich Reitebuch
      Version:
        20.01.04, 1.20 revised (ur) Missing handling of vertex normals added.
        14.06.02, 1.10 revised (ur) avoid PgVertexStar.makeVertexStar(*,*,-1).
        03.07.01, 1.00 created (ur)

    - #### closeHoles

          public static void closeHoles(PgElementSet geom)

      Close all holes in a geometry by the triangles that are generated by the triangulation of boundary polygons. Boundary polygons will be deleted, as there are no boundaries any longer.
      Author:
        Ulrich Reitebuch
      Version:
        20.06.17, 1.20 revised (ur) Better check of existence of boundary information.
        07.07.04, 1.10 revised (ur) Orient new triangles at old elements, compute normals.
        14.10.03, 1.00 created (ur)

    - #### getNumNonManifoldEdges

          public static int getNumNonManifoldEdges(PgElementSet geom)

      Count non-manifold edges contained in the geometry.
      Author:
        Ulrich Reitebuch
      Version:
        20.06.17, 1.01 revised (ur) Check that edgeStar not null.
        14.09.06, 1.00 created (ur)

    - #### removeNonManifoldEdges

          public static void removeNonManifoldEdges(PgElementSet geom)

      Remove non-manifold edges from the geometry. This method will insert new vertices upon non-manifold edges, so these degenerations are removed combinatorially; the geometry will not not be changed.
      Author:
        Ulrich Reitebuch
      Version:
        20.06.17, 1.01 revised (ur) Check that edgeStar not null.
        14.09.06, 1.00 created (ur)

    - #### removeNeighbourhoodDegenerations

          public static int removeNeighbourhoodDegenerations(PgElementSet geom)

      Detect pairs of elements, which have common vertices, which are not connected by a common edge. Split those elements. Correct neighbourhood information is required, element degenerations shall be removed beforehand, all vertices are supposed to be proper 2-manifold vertices.
      Author:
        Ulrich Reitebuch
      Version:
        22.09.06, 1.00 created (ur)

    - #### getNumNeighbourhoodDegenerations

          public static int getNumNeighbourhoodDegenerations(PgElementSet geom)

      Count pairs of elements, which have common vertices, which are not connected by a common edge. Correct neighbourhood information is required, element degenerations shall be removed beforehand, all vertices are supposed to be proper 2-manifold vertices.
      Author:
        Ulrich Reitebuch
      Version:
        22.09.06, 1.00 created (ur)

    - #### splitElementsByVertexSelection

          public static void splitElementsByVertexSelection(PgElementSet geom)

      Split elements by inserting edges between selected vertices.
      Author:
        Ulrich Reitebuch
      Version:
        11.12.09, 1.00 created (ur)

    - #### splitElement

          public static void splitElement(PgElementSet geom,
                                          int elIndex,
                                          int locInd0,
                                          int locInd1)

      Split a single element of a PgElementSet into two elements.

    - #### splitElement

          public static void splitElement(PgElementSet geom,
                                          int elIndex,
                                          int locInd0,
                                          int locInd1,
                                          boolean splitNeighbours)

      Split a single element of a PgElementSet into two elements.
      Parameters:
        `splitNeighbours` - If true, the neighbour information between the new elements will be destroyed.
      Author:
        Ulrich Reitebuch
      Version:
        11.02.08, 2.00 revised (mn) Added parameter splitNeighbour.
        23.01.08, 1.20 revised (mn) Added check if parameter are correct.
        28.11.06, 1.10 revised (ur) removed call of PgElementSet.addElement(...) method.
        18.09.06, 1.00 created (ur)

    - #### centralSplitSelectedElements

          public static void centralSplitSelectedElements(PgElementSet geom)

      Split all selected elements by inserting center vertices.
      Author:
        Ulrich Reitebuch
      Version:
        11.12.09, 1.00 created (ur)

    - #### centralSplit

          public static void centralSplit(PgElementSet geom,
                                          int elIndex)

      Split a single element of a PgElementSet into triangles by inserting a center vertex.
      Author:
        Ulrich Reitebuch
      Version:
        12.12.06, 1.10 revised (ur) Cleaned up allocation and blending.
        15.09.06, 1.00 created (ur)

    - #### checkManifold

          public static boolean checkManifold(PgElementSet geom,
                                              boolean bMessage)

      Check if a given element set is a 2D manifold.
      Parameters:
        `geom` - Geometry.
        `bMessage` - Flag to send messages to the JavaView console.
      Returns:
        True, if geom is a manifold surface.
      Author:
        Matthias Nieser
      Version:
        18.10.06, 1.00 revised (ur) Completely changed.
        20.06.06, 1.00 created (mn)

    - #### removeHangingNodes

          public static boolean removeHangingNodes(PgElementSet geom)

      Remove hanging nodes: Find adjacent boundary edges with opposite direction and insert the not common end point of the shorter edge upon the longer edge, split the resp. face. Edges of vanishing length are not handled, those may be removed by the identifyVertices method.

      This method will kill all those simple case that consist of a collinear closed three-vertex boundary; if longer collinear closed boundaries are in a geometry, they should disappear with repeated calls of this method.

      Returns:
        true if a hanging node was removed, false if no one was found.
      Author:
        Ulrich Reitebuch
      Version:
        28.11.06, 1.00 created (ur)

    - #### removeHangingNodes

          public static boolean removeHangingNodes(PgElementSet geom,
                                                   double maxAngle,
                                                   boolean splitElements)

      Remove hanging nodes: Find adjacent boundary edges with opposite direction and insert the not common end point of the shorter edge upon the longer edge, split the resp. face. Edges of vanishing length are not handled, those may be removed by the identifyVertices method.

      This method will kill all those simple case that consist of a collinear closed three-vertex boundary; if longer collinear closed boundaries are in a geometry, they should disappear with repeated calls of this method.

      Parameters:
        `maxAngle` - Two vectors are assumed to be parallel if the angle between them is smaller than maxAngle (in degrees).
        `splitElements` - Split elements instead of appending an existing element.
      Returns:
        true if a hanging node was removed, false if no one was found.
      Author:
        Ulrich Reitebuch
      Version:
        22.01.07, 1.10 revised (ah) Added parameters maxAngle and splitElements. 28.11.06, 1.00 created (ur)

    - #### collapseEdgesBetweenSelectedElements

          public static void collapseEdgesBetweenSelectedElements(PgElementSet geom)

      Collapse edges between pairs of selected elements - elements will be unselected, so no element will be collapsed at more than one edge.
      Author:
        Ulrich Reitebuch
      Version:
        18.09.2009, 1.00 created (ur)

    - #### collapseEdge

          public static int collapseEdge(PgElementSet geom,
                                         int elementIndex,
                                         int localIndex)

      Collapse a single edge in a PgElementSet.
      Parameters:
        `geom` - The PgElementSet.
        `elementIndex` - Index of element containing the edge to be collapsed.
        `localIndex` - Local index in the element (numbered as in neighbour).

    - #### computeElementNormal

          public static void computeElementNormal(PgElementSet geom,
                                                  int elementIndex)

      Compute an element normal anew.

    - #### computeElementNormal

          public static PdVector computeElementNormal(PdVector[] vertex)

      Compute normal of an element, given by its vertices in cyclic order.

    - #### splitCurvedPolygons

          public static void splitCurvedPolygons(PgPolygonSet polySet,
                                                 double threshold)

      Split polygons, until all polygons satisfy a straghtness criterion: All interiour vertices are sorted by their distance to the straight line between start and end point. If the ratio of distance and length of the line between the start and end point is greater than the given threshold parameter, the polygon will be split at the farest vertex.
      Author:
        Ulrich Reitebuch
      Version:
        05.04.2007, 1.00 created (ur)

    - #### flipEdgesBetweenSelectedElements

          public static void flipEdgesBetweenSelectedElements(PgElementSet geom)

      Flip edges between pairs of selected elements - elements will be unselected, so no element will be flipped at more than one edge.
      Author:
        Ulrich Reitebuch
      Version:
        18.09.2009, 1.00 created (ur)

    - #### flipEdge

          public static void flipEdge(PgElementSet geom,
                                      int elementIndex,
                                      int localIndex)

      Flip a single edge of a PgElementSet.
      Author:
        Ulrich Reitebuch
      Version:
        27.07.2007, 1.00 created (ur)

    - #### mergeSelectedElements

          public static void mergeSelectedElements(PgElementSet geom)

      Merge pairs of neighbouring selected elements.
      Author:
        Ulrich Reitebuch
      Version:
        10.12.09, 1.00 created (ur)

    - #### joinElements

          public static void joinElements(PgElementSet elementSet,
                                          int index,
                                          int localIndex)

      Join two elements. The indicated element will be replaced by the joined element, the neighbour element will be tagged as PsObject.IS_DELETED.
      Author:
        Ulrich Reitebuch
      Version:
        10.12.09, 1.00 created (ur)

    - #### flipOrientationSelectedElements

          public static void flipOrientationSelectedElements(PgElementSet geom)

      Flip orientation of all elements tagged by PsObject.IS_SELECTED.
      Author:
        Ulrich Reitebuch
      Version:
        21.12.09, 1.00 created (ur)

    - #### flipOrientationOfElement

          public static void flipOrientationOfElement(PgElementSet geom,
                                                      int index)

      Flip orientation of a single element.
      Author:
        Ulrich Reitebuch
      Version:
        21.12.09, 1.00 created (ur)

    - #### rotateStarsSelectedVertices

          public static void rotateStarsSelectedVertices(PgElementSet elementSet)

      Rotate Vertex stars of all vertices tagged by PsObject.IS_SELECTED.
      Parameters:
        `elementSet` - The geometry to be modified.
      Author:
        Ulrich Reitebuch
      Version:
        15.12.09, 1.00 created (ur)

    - #### rotateStar

          public static void rotateStar(PgElementSet elementSet,
                                        int index,
                                        int elIndex)

      Rotate a vertex star - each edge connecting the center vertex to a vertex in the link will be moved to the next vertex in the vertex star's boundary. Method does up to now work for closed vertex stars only.
      Parameters:
        `elementSet` - The geometry to be modified.
        `index` - Index of the vertex star to be rotated.
        `elIndex` - Index of an adjacent element, may be -1.
      Author:
        Ulrich Reitebuch
      Version:
        15.12.09, 1.00 created (ur)

    - #### removeSelectedVerticesAndFill

          public static void removeSelectedVerticesAndFill(PgElementSet elementSet)

      Remove all selected vertices and fill the holes by new elements given by the neighbouring vertices.
      Parameters:
        `elementSet` - The geometry to be modified.
      Author:
        Ulrich Reitebuch
      Version:
        15.12.09, 1.00 created (ur)

    - #### removeVertexAndFill

          public static void removeVertexAndFill(PgElementSet elementSet,
                                                 int index,
                                                 int elIndex)

      Remove a vertex and fill the hole by a new element given by all neighbouring vertices.
      Parameters:
        `elementSet` - The geometry to be modified.
        `index` - Index of the vertex to be removed
        `elIndex` - Index of an adjacent element, may be -1.
      Author:
        Ulrich Reitebuch
      Version:
        14.12.09, 1.00 created (ur)

    - #### removeValence3Vertices

          public static void removeValence3Vertices(PgElementSet elementSet)

      Valence 3 vertices are removed by edge collapse. Since in this case the edge collapse decreases the valence of the other vertex it might be necessary to call the method several times.
      Author:
        Ulrich Reitebuch
      Version:
        19.03.14, 1.00 created (ur)

    - #### identifyMarkedVertices

          public static void identifyMarkedVertices(PgElementSet elementSet)

      Identify Selected Vertices, the position of the new vertex will be averaged from the identified vertices.
      Author:
        Ulrich Reitebuch
      Version:
        18.01.10, 1.00 created (ur)

    - #### scrambleElements

          public static void scrambleElements(PgElementSet elementSet)

      Change the internal order of indices of the vertices in all triangles by random to get arbitrary examples for testing the algorithm.
      Author:
        Ulrich Reitebuch
      Version:
        30.11.07, 1.10 revised (ur) Moved here from jvx.geom.PwMatching, now handles elements of all sizes.
        07.11.03, 1.00 created (ur)

    - #### removeSmallAngles

          public static void removeSmallAngles(PgElementSet geom,
                                               double eps,
                                               boolean bRemove)

      Clean mesh from small angles i.e. flip edges opposite to angles close to `PI`, collapse edges opposite of angles close to 0.
      Parameters:
        `geom` - Triangulated geometry.
        `eps` - Threshold in radians.
        `bRemove` - Flag whether or not to remove elements/vertices marked as `PsObject.IS_DELETED`.
      Version:
        03.04.14, 1.10 revised (ur) Rewritten with more security checks.
        22.12.09, 1.00 created (ur)

    - #### resamplePolygon

          public static void resamplePolygon(PgPolygon polygon,
                                             int numSamples)

      Uniformly resample a PgPolygon.

"

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