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 intMETHOD_ANISO_PRESCRIBEDPrescribed anisotropic smoothing preserves sharp features and additionally avoids shrinking.static intMETHOD_ANISOTROPICAnisotropic smoothing preserves and sharpens linear features.static intMETHOD_ISO_PRESCRIBEDPrescribed isotropic smoothing avoids shrinking.static intMETHOD_LAPLACEIsotropic cotan Laplacian smoothing.PvViewerviewer-
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 voidcancel()Cancel operation of this workshop by resetting the assigned geometry, and finally close this workshop.static java.awt.ColorcolorMap(double d)Maps (0,1) onto a Color, starting from white to red.static java.awt.ColorcolorMapGray(double d)Maps (0,1) onto a Color using only gray levels.PdVector[]computeGradient()Compute anisotropic gradient and returns as PdVector.doublegetFeatureDetect()Get parameter that determines what is regarded as a feature when smoothing.booleangetKeepBoundary()Get flag to enable/disable moving of boundary vertices during smoothing.booleangetKeepSelected()Get flag to enable/disable moving of selected vertices during smoothing.intgetMaxNumLoops()A smoothing process is stopped after this number of loops have been performed cpstart.intgetMethod()Get method used for smoothing.doublegetStepWidth()The step width is a factor the gradient of the actual flow is multiplied with at each iteration step.voidinit()InitializationsbooleanisRunning()Check whether smoothing process will be stopped.booleanisStopped()Check whether smoothing process is currently NOT running a thread.booleanisUsingImplicit()See if implicit method to integrate the flow is used.voidrun()Do energy minimization untilm_numLoopsare done or until a call of stop().static booleanscaleGeomByVolume(PgElementSet geom, double volume, double eps, int maxSteps)Rescale geometry to have a given volume.voidsetFeatureDetect(double value)Set parameter that determines what is regarded as a feature when smoothing.voidsetGeometry(PgElementSet geom)Assign a geometry on which this workshop operates, and create a backup copy if workshop is cancelled.voidsetKeepBoundary(boolean bKeepBoundary)Enable/Disable moving of boundary vertices during smoothing.voidsetKeepSelected(boolean bKeepSelected)Enable/Disable moving of selected vertices during smoothing.voidsetMaxNumLoops(int numLoops)A smoothing process is stopped after the given number of loops have been performed cpstart.voidsetMethod(int method)Set method used for smoothing.voidsetStepWidth(double stepWidth)The step width is a factor the gradient of the actual flow is multiplied with at each iteration step.voidsmoothingStep()Perform one step of smoothing using the actually chosen method and settings.voidstart()Start smoothing in separate thread.voidstop()Stop smoothing in separate thread.booleanupdate(java.lang.Object event)Update the class whenever a child has changed.voiduseImplicit(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
-
-
Method Detail
-
init
public void init()
Initializations- Overrides:
initin classPjWorkshop
-
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:
updatein interfacePsUpdateIf- Overrides:
updatein classPjWorkshop- 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:PjWorkshopCancel 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:
cancelin classPjWorkshop
-
setMethod
public void setMethod(int method)
Set method used for smoothing. All methods available are indexed seeMETHOD_ANISOTROPICandMETHOD_ANSIO_PRECRIBED.
-
getMethod
public int getMethod()
Get method used for smoothing. All methods available are indexed seeMETHOD_ANISOTROPICandMETHOD_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 cpstart.
-
getMaxNumLoops
public int getMaxNumLoops()
A smoothing process is stopped after this number of loops have been performed cpstart.
-
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 untilm_numLoopsare done or until a call of stop().- Specified by:
runin interfacejava.lang.Runnable
-
-
"