jvx.geom

## Class PwSimplify

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

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

      public class PwSimplify
      extends PjWorkshop

  Simplifies a geometry by collapsing edges. Edges to remove are selected by smallest surface error in the quadric metric following the algorithm of Heckbert and Garland.
  See Also:
    Serialized Form
  Author:
    Ulrich Reitebuch
  Version:
    11.08.10, 2.30 revised (ur) Allow prioritizing by edge length.
    21.04.10, 2.20 revised (ur) Store a mapping information for each original vertex to the vertex it is collapsed into.
    05.10.04, 2.10 revised (ur) Slider for target number of elements moved to this class.
    29.09.04, 2.00 revised (ep) A label with the current number of triangles can now be switched on/off.
    24.07.03, 1.90 revised (kp) isEnabled/setEnabled methods added.
    24.07.03, 1.80 revised (kp) Prepare() now protected and called internally.
    31.03.03, 1.70 revised (kp) Avoid assignment of normal vectors if not originally there.
    06.02.03, 1.60 revised (ur) Full Revision. Most local variables removed from often called methods.
    29.12.01, 1.50 revised (kp) Revision when superclass changed to PjWorkshop from PsObject.
    01.02.01, 1.20 revised (ur) Enabled refusing of simplification.
    20.11.00, 1.10 revised (ur) Updating of boundary polygons improved.
    20.09.00, 1.01 revised (ur) Simplifying elementSets with unused vertices is now possible.
    15.02.00, 1.00 created (ur)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ABSOLUTE_SLIDER`
    `boolean` | `m_bGenerateVertexMap` Flag to generate an index map from original geometry vertices to the coarse vertices they are collapsed to.
    `boolean` | `m_bPrioritiseByEdgeLength` Flag to use edge lengths as priority keys.
    `int` | `m_sliderType`
    `PiVector` | `m_vertexMap` Index map from original geometry vertices to the coarse vertices they are collapsed to.
    `static int` | `PERCENT_SLIDER`

    - ### 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
    `PwSimplify()` Constructor.
    `PwSimplify(PgElementSet anElementSet)` Deprecated. use constructor prj=new PwSimplify();prj.setGeometry(geom);prj.reset();

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Remove all internal variables and break external links.
    `void` | `init()` Initialization.
    `boolean` | `isEnabledCheckAngles()` Determine if inner angles of triangles are checked during simplification.
    `boolean` | `isEnabledCheckNormals()` Check if normals of new faces are allowed to differ from old normals by more than the initial value of m_maxAngle.
    `boolean` | `isEnabledFlipEdges()` Determine if triangle edges are flipped before simplification.
    `boolean` | `isEnabledForceSimplify()` Check if other simplification criteria are allowed to be relaxed during the simplification in order to simplify down to the requested remaining number of elements.
    `boolean` | `isEnabledKeepBoundary()` Check if boundary points of PgElementSet are kept and not removed during simplification.
    `boolean` | `isEnabledKeepMarkedVertices()` Check if marked points of PgElementSet are kept and not removed during simplification.
    `boolean` | `isShowingNumTriangles()` Whether the number of triangles is shown in the registered display.
    `void` | `reset()` Remove all previously done simplification and set the workshop to its initial status.
    `void` | `setDisplay(PvDisplayIf disp)` Sets the display used for showing the number of triangles.
    `void` | `setEnabledCheckAngles(boolean flag)` Determine if inner angles of triangles are checked during simplification.
    `void` | `setEnabledCheckNormals(boolean flag)` Determine if normals of new faces are allowed to differ from old normals by more than the initial value of m_maxAngle.
    `void` | `setEnabledFlipEdges(boolean flag)` Determine if triangle edges are flipped before simplification.
    `void` | `setEnabledForceSimplify(boolean flag)` Determine if other simplification criteria are allowed to be relaxed during the simplification in order to simplify down to the requested remaining number of elements.
    `void` | `setEnabledKeepBoundary(boolean flag)` Determine if boundary points of PgElementSet are kept and not removed during simplification.
    `void` | `setEnabledKeepMarkedVertices(boolean flag)` Determine if marked points of PgElementSet are kept and not removed during simplification.
    `void` | `setGeometry(PgElementSet geom)` Register a geometry on this workshop will operate.
    `void` | `setSliderType(int type)` Set type of slider to PERCENT_SLIDER or ABSOLUTE_SLIDER.
    `void` | `showNumTriangles(boolean flag)` Whether to show the number of triangles in the registered display.
    `int` | `simplify()` Call simplify(#faces) or simplifyByFactor(factor) according to Slider type.
    `int` | `simplify(int remainElements)` Simplify the PgElementSet until it has few enough elements.
    `int` | `simplifyByFactor(double fac)` Reduce number of elements of a surface to a given percentage.
    `boolean` | `update(java.lang.Object event)` Update if workshop or slider values change.
    `void` | `updateSlider()` Adjust slider bounds and value to the geometry.

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

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

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

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, 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, getName, setParent`

- - ### Field Detail

    - #### PERCENT_SLIDER

          public static final int PERCENT_SLIDER

      See Also:
        Constant Field Values

    - #### ABSOLUTE_SLIDER

          public static final int ABSOLUTE_SLIDER

      See Also:
        Constant Field Values

    - #### m_sliderType

          public int m_sliderType

    - #### m_bGenerateVertexMap

          public boolean m_bGenerateVertexMap

      Flag to generate an index map from original geometry vertices to the coarse vertices they are collapsed to.

    - #### m_vertexMap

          public PiVector m_vertexMap

      Index map from original geometry vertices to the coarse vertices they are collapsed to.

    - #### m_bPrioritiseByEdgeLength

          public boolean m_bPrioritiseByEdgeLength

      Flag to use edge lengths as priority keys. Edges will be collapsed into edge mid points.

  - ### Constructor Detail

    - #### PwSimplify

          public PwSimplify(PgElementSet anElementSet)

      Deprecated. use constructor prj=new PwSimplify();prj.setGeometry(geom);prj.reset();
      Constructor.

    - #### PwSimplify

          public PwSimplify()

      Constructor.

  - ### Method Detail

    - #### init

          public void init()

      Initialization.
      Overrides:
        `init` in class `PjWorkshop`

    - #### setGeometry

          public void setGeometry(PgElementSet geom)

      Register a geometry on this workshop will operate.

    - #### updateSlider

          public void updateSlider()

      Adjust slider bounds and value to the geometry.

    - #### setSliderType

          public void setSliderType(int type)

      Set type of slider to PERCENT_SLIDER or ABSOLUTE_SLIDER.

    - #### reset

          public void reset()

      Remove all previously done simplification and set the workshop to its initial status.
      Overrides:
        `reset` in class `PjWorkshop`

    - #### close

          public void close()

      Remove all internal variables and break external links. Here the control grid is removed from the display.
      Overrides:
        `close` in class `PjWorkshop`
      Since:
        JavaView 2.87.000
      Version:
        24.07.03, 1.00 created (kp) Method is part of the workshop concept.

    - #### isEnabledKeepBoundary

          public boolean isEnabledKeepBoundary()

      Check if boundary points of PgElementSet are kept and not removed during simplification.

    - #### setEnabledKeepBoundary

          public void setEnabledKeepBoundary(boolean flag)

      Determine if boundary points of PgElementSet are kept and not removed during simplification.

    - #### isEnabledKeepMarkedVertices

          public boolean isEnabledKeepMarkedVertices()

      Check if marked points of PgElementSet are kept and not removed during simplification.

    - #### setEnabledKeepMarkedVertices

          public void setEnabledKeepMarkedVertices(boolean flag)

      Determine if marked points of PgElementSet are kept and not removed during simplification.

    - #### isEnabledCheckNormals

          public boolean isEnabledCheckNormals()

      Check if normals of new faces are allowed to differ from old normals by more than the initial value of m_maxAngle.

    - #### setEnabledCheckNormals

          public void setEnabledCheckNormals(boolean flag)

      Determine if normals of new faces are allowed to differ from old normals by more than the initial value of m_maxAngle.

    - #### isEnabledForceSimplify

          public boolean isEnabledForceSimplify()

      Check if other simplification criteria are allowed to be relaxed during the simplification in order to simplify down to the requested remaining number of elements.

    - #### setEnabledForceSimplify

          public void setEnabledForceSimplify(boolean flag)

      Determine if other simplification criteria are allowed to be relaxed during the simplification in order to simplify down to the requested remaining number of elements.

    - #### isEnabledCheckAngles

          public boolean isEnabledCheckAngles()

      Determine if inner angles of triangles are checked during simplification.

    - #### setEnabledCheckAngles

          public void setEnabledCheckAngles(boolean flag)

      Determine if inner angles of triangles are checked during simplification.

    - #### isEnabledFlipEdges

          public boolean isEnabledFlipEdges()

      Determine if triangle edges are flipped before simplification.

    - #### setEnabledFlipEdges

          public void setEnabledFlipEdges(boolean flag)

      Determine if triangle edges are flipped before simplification.

    - #### setDisplay

          public void setDisplay(PvDisplayIf disp)

      Sets the display used for showing the number of triangles.
      Specified by:
        `setDisplay` in interface `PjWorkshopIf`
      Overrides:
        `setDisplay` in class `PjWorkshop`
      See Also:
        `showNumTriangles(boolean)`

    - #### showNumTriangles

          public void showNumTriangles(boolean flag)

      Whether to show the number of triangles in the registered display. This is done by adding a point set to the display and setting its name correspondingly.
      Since:
        JavaView 3.57
      See Also:
        `setDisplay(PvDisplayIf)`
      Version:
        29.09.04, 1.00 created (ep)

    - #### isShowingNumTriangles

          public boolean isShowingNumTriangles()

      Whether the number of triangles is shown in the registered display. This is done by adding a point set to the display and setting its name correspondingly.
      Since:
        JavaView 3.57
      Version:
        29.09.04, 1.00 created (ep)

    - #### simplify

          public int simplify()

      Call simplify(#faces) or simplifyByFactor(factor) according to Slider type.

    - #### simplifyByFactor

          public int simplifyByFactor(double fac)

      Reduce number of elements of a surface to a given percentage. If the total number of elements is `num` and the factor `0 < fac < 1` (within 0. and 1.) then the number of remaining elements is aimed at num*val.
      Parameters:
        `fac` - fac between 0. and 1.
      Returns:
        actual new number of elements, -1 if an error occurred
      Author:
        Konrad Polthier
      Version:
        10.05.03, 1.00 revised (kp) Renamed to simplifyByFactor() from simplify(double).
        10.05.03, 1.00 created (kp)

    - #### simplify

          public int simplify(int remainElements)

      Simplify the PgElementSet until it has few enough elements.
      Parameters:
        `remainElements` - requested number of remaining elements.
      Returns:
        actual new number of elements, -1 if an error occurred.
      Author:
        Ulrich Reitebuch
      Version:
        21.02.07, 1.35 revised (ur) Textfield showing number of elements is no longer updated for every edge collapse.
        06.05.05, 1.30 revised (kp) Update of boundary adjusted to changed handling of bnd in PgElementSet.
        24.07.03, 1.20 revised (kp) Call prepare() from here, check if elementSet is empty.
        20.11.00, 1.10 revised (ur) Updating of boundary polygons improved.
        15.02.00, 1.00 created (ur)

    - #### update

          public boolean update(java.lang.Object event)

      Update if workshop or slider values change.
      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)`
      Version:
        22.07.05, 1.10 revised (kp) Missing return in update of m_targetNumber inserted.
        29.09.04, 1.00 created (ep)

"

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