jvx.geom

## Class PwSmooth

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

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

      public class PwSmooth
      extends PjWorkshop
      implements java.lang.Runnable

  Workshop for feature preserving smoothing of surfaces. Anisotropic mean curvature flow and anisotropic prescribed mean curvature flow are implemented.
  See Also:
    Serialized Form
  Author:
    Klaus Hildebrandt
  Version:
    29.10.2016, 1.20 revised (kp) Element colors switched on by default.
    10.03.2014, 1.10 revised (kp) Code cleanup.
    00.00.2003, 1.00 created (kh)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `METHOD_ANISO_PRESCRIBED` Prescribed anisotropic smoothing preserves sharp features and additionally avoids shrinking.
    `static int` | `METHOD_ANISOTROPIC` Anisotropic smoothing preserves and sharpens linear features.
    `static int` | `METHOD_ISO_PRESCRIBED` Prescribed isotropic smoothing avoids shrinking.
    `static int` | `METHOD_LAPLACE` Isotropic cotan Laplacian smoothing.
    `PvViewer` | `viewer`

    - ### 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
    `PwSmooth()` Constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel()` Cancel operation of this workshop by resetting the assigned geometry, and finally close this workshop.
    `static java.awt.Color` | `colorMap(double d)` Maps (0,1) onto a Color, starting from white to red.
    `static java.awt.Color` | `colorMapGray(double d)` Maps (0,1) onto a Color using only gray levels.
    `PdVector[]` | `computeGradient()` Compute anisotropic gradient and returns as PdVector.
    `double` | `getFeatureDetect()` Get parameter that determines what is regarded as a feature when smoothing.
    `boolean` | `getKeepBoundary()` Get flag to enable/disable moving of boundary vertices during smoothing.
    `boolean` | `getKeepSelected()` Get flag to enable/disable moving of selected vertices during smoothing.
    `int` | `getMaxNumLoops()` A smoothing process is stopped after this number of loops have been performed cp `start`.
    `int` | `getMethod()` Get method used for smoothing.
    `double` | `getStepWidth()` The step width is a factor the gradient of the actual flow is multiplied with at each iteration step.
    `void` | `init()` Initializations
    `boolean` | `isRunning()` Check whether smoothing process will be stopped.
    `boolean` | `isStopped()` Check whether smoothing process is currently NOT running a thread.
    `boolean` | `isUsingImplicit()` See if implicit method to integrate the flow is used.
    `void` | `run()` Do energy minimization until `m_numLoops` are done or until a call of stop().
    `static boolean` | `scaleGeomByVolume(PgElementSet geom, double volume, double eps, int maxSteps)` Rescale geometry to have a given volume.
    `void` | `setFeatureDetect(double value)` Set parameter that determines what is regarded as a feature when smoothing.
    `void` | `setGeometry(PgElementSet geom)` Assign a geometry on which this workshop operates, and create a backup copy if workshop is cancelled.
    `void` | `setKeepBoundary(boolean bKeepBoundary)` Enable/Disable moving of boundary vertices during smoothing.
    `void` | `setKeepSelected(boolean bKeepSelected)` Enable/Disable moving of selected vertices during smoothing.
    `void` | `setMaxNumLoops(int numLoops)` A smoothing process is stopped after the given number of loops have been performed cp `start`.
    `void` | `setMethod(int method)` Set method used for smoothing.
    `void` | `setStepWidth(double stepWidth)` The step width is a factor the gradient of the actual flow is multiplied with at each iteration step.
    `void` | `smoothingStep()` Perform one step of smoothing using the actually chosen method and settings.
    `void` | `start()` Start smoothing in separate thread.
    `void` | `stop()` Stop smoothing in separate thread.
    `boolean` | `update(java.lang.Object event)` Update the class whenever a child has changed.
    `void` | `useImplicit(boolean flag)` Use implicit instead of explicit method to integrate the flow.

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

      `close, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, removeGeometry, reset, setDisplay, 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

    - #### METHOD_ANISOTROPIC

          public static int METHOD_ANISOTROPIC

      Anisotropic smoothing preserves and sharpens linear features.

    - #### METHOD_ANISO_PRESCRIBED

          public static int METHOD_ANISO_PRESCRIBED

      Prescribed anisotropic smoothing preserves sharp features and additionally avoids shrinking.

    - #### METHOD_ISO_PRESCRIBED

          public static int METHOD_ISO_PRESCRIBED

      Prescribed isotropic smoothing avoids shrinking.

    - #### METHOD_LAPLACE

          public static int METHOD_LAPLACE

      Isotropic cotan Laplacian smoothing.

    - #### viewer

          public PvViewer viewer

  - ### Constructor Detail

    - #### PwSmooth

          public PwSmooth()

      Constructor

  - ### Method Detail

    - #### init

          public void init()

      Initializations
      Overrides:
        `init` 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)`

    - #### setGeometry

          public void setGeometry(PgElementSet geom)

      Assign a geometry on which this workshop operates, and create a backup copy if workshop is cancelled.

    - #### cancel

          public void cancel()

      Description copied from class: `PjWorkshop`
      Cancel operation of this workshop by resetting the assigned geometry, and finally close this workshop.

      If necessary, the duplicate of the original geometry is restored into the geometry. The update method of the geometry is called.

      Overrides:
        `cancel` in class `PjWorkshop`

    - #### setMethod

          public void setMethod(int method)

      Set method used for smoothing. All methods available are indexed see `METHOD_ANISOTROPIC` and `METHOD_ANSIO_PRECRIBED`.

    - #### getMethod

          public int getMethod()

      Get method used for smoothing. All methods available are indexed see `METHOD_ANISOTROPIC` and `METHOD_ANSIO_PRECRIBED`.

    - #### setFeatureDetect

          public void setFeatureDetect(double value)

      Set parameter that determines what is regarded as a feature when smoothing.

    - #### getFeatureDetect

          public double getFeatureDetect()

      Get parameter that determines what is regarded as a feature when smoothing.

    - #### useImplicit

          public void useImplicit(boolean flag)

      Use implicit instead of explicit method to integrate the flow.

    - #### isUsingImplicit

          public boolean isUsingImplicit()

      See if implicit method to integrate the flow is used.

    - #### setStepWidth

          public void setStepWidth(double stepWidth)

      The step width is a factor the gradient of the actual flow is multiplied with at each iteration step. This parameter is often called the time discretization of the flow. A recommended choice is between 0.01 and 0.1.

    - #### getStepWidth

          public double getStepWidth()

      The step width is a factor the gradient of the actual flow is multiplied with at each iteration step. This parameter is often called the time discretization of the flow. A recommended choice is between 0.01 and 0.1.

    - #### setMaxNumLoops

          public void setMaxNumLoops(int numLoops)

      A smoothing process is stopped after the given number of loops have been performed cp `start`.

    - #### getMaxNumLoops

          public int getMaxNumLoops()

      A smoothing process is stopped after this number of loops have been performed cp `start`.

    - #### setKeepBoundary

          public void setKeepBoundary(boolean bKeepBoundary)

      Enable/Disable moving of boundary vertices during smoothing.

    - #### getKeepBoundary

          public boolean getKeepBoundary()

      Get flag to enable/disable moving of boundary vertices during smoothing.

    - #### setKeepSelected

          public void setKeepSelected(boolean bKeepSelected)

      Enable/Disable moving of selected vertices during smoothing.

    - #### getKeepSelected

          public boolean getKeepSelected()

      Get flag to enable/disable moving of selected vertices during smoothing.

    - #### computeGradient

          public PdVector[] computeGradient()

      Compute anisotropic gradient and returns as PdVector.
      Version:
        29.03.2017, 1.10 revised (kp) Method made public since used outside.

    - #### smoothingStep

          public void smoothingStep()

      Perform one step of smoothing using the actually chosen method and settings.

    - #### colorMapGray

          public static java.awt.Color colorMapGray(double d)

      Maps (0,1) onto a Color using only gray levels.

    - #### colorMap

          public static java.awt.Color colorMap(double d)

      Maps (0,1) onto a Color, starting from white to red.

    - #### scaleGeomByVolume

          public static boolean scaleGeomByVolume(PgElementSet geom,
                                                  double volume,
                                                  double eps,
                                                  int maxSteps)

      Rescale geometry to have a given volume. Method iteratively approximates the given value. Rescaling stops when actual volume and given volume differ less than given eps or more than given maximal number of steps have been performed.
      Parameters:
        `geom` - geometry to be scaled.
        `volume` - volume the geometry will have after rescaling.
        `eps` - rescaling stops when actual volume and given volume differ less than eps.
        `maxSteps` - stop when maximal number of steps have been performed.
      Returns:
        false if maximal number of steps has been reached, true otherwise.

    - #### isRunning

          public boolean isRunning()

      Check whether smoothing process will be stopped.
      Returns:
        false, if the energy minimizer will stop (just shutting down regularly).

    - #### isStopped

          public boolean isStopped()

      Check whether smoothing process is currently NOT running a thread.

    - #### start

          public void start()

      Start smoothing in separate thread.
      See Also:
        `stop()`

    - #### stop

          public void stop()

      Stop smoothing in separate thread.

    - #### run

          public void run()

      Do energy minimization until `m_numLoops` are done or until a call of stop().
      Specified by:
        `run` in interface `java.lang.Runnable`

"

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