JavaView© v3.95.000

jvx.geom
Class PwUnfold

java.lang.Object
  extended byjv.object.PsObject
      extended byjvx.project.PjWorkshop
          extended byjvx.geom.PwUnfold
All Implemented Interfaces:
java.lang.Cloneable, PjWorkshopIf, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf, java.lang.Runnable, java.io.Serializable

public class PwUnfold
extends PjWorkshop
implements PsTimeListenerIf, java.lang.Runnable, PvPickListenerIf

Workshop for unfolding of geometries. Unfolding is animatable. Optionally tabs that help to create a paper model of the geometry can be generated.

See Also:
Serialized Form

Field Summary
static int WEIGHT_EDGELENGTH
          Compute unfolding respecting the length of the edges.
static int WEIGHT_ELEMENTINDEX
          Compute unfolding respecting at each interior edge the absolute of the difference of the two adjacent elements.
 
Fields inherited from class jv.object.PsObject
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
 
Constructor Summary
PwUnfold()
          Constructor.
 
Method Summary
 void cancel()
          Stop any animation and restore the geometry to its original state.
 void dragDisplay(PvPickEvent pos)
          Drag a location in the display with 2d display and 3d world coordinates.
 void dragInitial(PvPickEvent pos)
          Drag an arbitrary point along a geometry, point may lie inside an element.
 void dragVertex(PgGeometryIf geom, int index, PdVector vertex)
          Drag a picked vertex of a geometry.
 void fitGeometry(boolean flag)
          Enable/Disable fitting of geometry to the display after each step of the animation.
 void flatten(double d)
          Incrementally flatten the registered geometry.
 PsAnimation getAnimation()
          Get the animation of the unfolding.
 int getFixedElement()
          Get index of element to be fixed.
 int getWeight()
          Get the weight used to compute the unfolding.
 boolean hasAnimation()
          Check if the animation is available.
 boolean improveUnfolding()
          Method to reduce the number of components the unfolding consists of.
 void init()
          Initialization.
 boolean isEnabledFixingElement()
          Check if freezing of the position of one element while the animation runs is enabled.
 boolean isFittingGeometry()
          Check if fitting of geometry to the display after each step of the animation is enabled.
 boolean isRunning()
          Check whether smoothing prcess will be stopped.
 boolean isShowingSplices()
          Check visibility of splices along cuts of the flattened surface.
 boolean isStopped()
          Check whether smoothing prcess is currently NOT running a thread.
 void markVertices(PvPickEvent pos)
          Mark a set of vertices of a geometry within a given bounding box.
 void ok()
          Accept current version of the geometry as new version.
 void pickDisplay(PvPickEvent pos)
          Get a location in the display with 2d display and 3d world coordinates.
 void pickInitial(PvPickEvent pos)
          Pick an arbitrary point on a geometry, point may lie inside an element.
 void pickVertex(PgGeometryIf geom, int index, PdVector vertex)
          Get a picked vertex of a geometry.
 void refold()
          Refold the geometry to its original position.
 void reset()
          Reset workshop and geometry to original state.
 void run()
           
 void selectGeometry(PgGeometryIf geom)
          Currently not supported by display.
 void setAnimation(PsAnimation anim)
          Register an animation to the workshop.
 void setDisplay(PvDisplayIf disp)
          Set the active display when this workshop was launched.
 void setEnabledFixingElement(boolean flag)
          Enable/Disable freezing of the position of one element while the animation runs.
 void setFixedElement(int anIndex)
          Give index of element to be fixed.
 void setGeometry(PgElementSet geom)
          Set geometry to be worked on.
 boolean setTime(PsTimeEvent timeEvent)
          Set the time of the animation.
 void setWeight(int weight)
          Set the weight used to compute the unfolding.
 void showSplices(boolean flag)
          Enable visibility of splices along cuts of the flattened surface.
 void start()
          Start smoothing in separate thread.
 void stop()
          Stop smoothing in separate thread.
 void unfold()
          Unfold the actual geometry.
 void unmarkVertices(PvPickEvent pos)
          Unmark a set of vertices of a geometry within a given bounding box.
 boolean update(java.lang.Object event)
          Update the class whenever a child has changed.
 
Methods inherited from class jvx.project.PjWorkshop
close, getDisplay, getDisplays, getGeometry, getSavedGeometry, getViewer, isModal, removeGeometry, setDisplays, setGeometry, setModal, 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.anim.PsTimeListenerIf
getName
 
Methods inherited from interface jv.project.PvPickListenerIf
getName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
 

Field Detail

WEIGHT_EDGELENGTH

public static final int WEIGHT_EDGELENGTH
Compute unfolding respecting the length of the edges.

See Also:
Constant Field Values

WEIGHT_ELEMENTINDEX

public static final int WEIGHT_ELEMENTINDEX
Compute unfolding respecting at each interior edge the absolute of the difference of the two adjacent elements.

See Also:
Constant Field Values
Constructor Detail

PwUnfold

public PwUnfold()
Constructor.

Method Detail

init

public void init()
Initialization.

Overrides:
init in class PjWorkshop

reset

public void reset()
Reset workshop and geometry to original state.

Overrides:
reset in class PjWorkshop

ok

public void ok()
Accept current version of the geometry as new version. Close workshop. The copy of the original geometry is ignored.

Overrides:
ok in class PjWorkshop

cancel

public void cancel()
Stop any animation and restore the geometry to its original state.

Overrides:
cancel 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.

setGeometry

public void setGeometry(PgElementSet geom)
Set geometry to be worked on.

Parameters:
geom - geometry will be unfolded.

setDisplay

public void setDisplay(PvDisplayIf disp)
Description copied from class: PjWorkshop
Set the active display when this workshop was launched.

Specified by:
setDisplay in interface PjWorkshopIf
Overrides:
setDisplay in class PjWorkshop

setWeight

public void setWeight(int weight)
Set the weight used to compute the unfolding. Weight is not used by improve unfolding


getWeight

public int getWeight()
Get the weight used to compute the unfolding. Weight is not used by improve unfolding


flatten

public void flatten(double d)
Incrementally flatten the registered geometry.

Parameters:
d - parameter in [0,1] describes the flattening state.

setEnabledFixingElement

public void setEnabledFixingElement(boolean flag)
Enable/Disable freezing of the position of one element while the animation runs. This avoids unnecessary bouncing of the geometry during the animation.

See Also:
isEnabledFixingElement(), setFixedElement(int), getFixedElement()

isEnabledFixingElement

public boolean isEnabledFixingElement()
Check if freezing of the position of one element while the animation runs is enabled.

See Also:
setEnabledFixingElement(boolean), setFixedElement(int), getFixedElement()

setFixedElement

public void setFixedElement(int anIndex)
Give index of element to be fixed. The position of this element are freezed when the animation runs.

See Also:
isEnabledFixingElement(), getFixedElement()

getFixedElement

public int getFixedElement()
Get index of element to be fixed. The position of this element are freezed when the animation runs.

See Also:
isEnabledFixingElement(), setFixedElement(int)

fitGeometry

public void fitGeometry(boolean flag)
Enable/Disable fitting of geometry to the display after each step of the animation.

See Also:
isFittingGeometry()

isFittingGeometry

public boolean isFittingGeometry()
Check if fitting of geometry to the display after each step of the animation is enabled.

See Also:
fitGeometry(boolean)

isShowingSplices

public boolean isShowingSplices()
Check visibility of splices along cuts of the flattened surface.

Since:
JavaView 2.87.000

showSplices

public void showSplices(boolean flag)
Enable visibility of splices along cuts of the flattened surface. This enables to glue papers models to closed surfaces.

Note, splices are only visible if the model is fully flattened. During all other states splices are automatically switched off.

Since:
JavaView 2.87.000

unfold

public void unfold()
Unfold the actual geometry.

See Also:
refold()

refold

public void refold()
Refold the geometry to its original position.

See Also:
unfold()

getAnimation

public PsAnimation getAnimation()
Get the animation of the unfolding.

Specified by:
getAnimation in interface PsTimeListenerIf
See Also:
PsAnimation, PsTimeListenerIf

hasAnimation

public boolean hasAnimation()
Check if the animation is available.

Specified by:
hasAnimation in interface PsTimeListenerIf
See Also:
PsAnimation, PsTimeListenerIf

setAnimation

public void setAnimation(PsAnimation anim)
Register an animation to the workshop.

Specified by:
setAnimation in interface PsTimeListenerIf
See Also:
PsAnimation, PsTimeListenerIf

setTime

public boolean setTime(PsTimeEvent timeEvent)
Set the time of the animation. Animation updates the dynamic object through this method whenever time has changed.

Specified by:
setTime in interface PsTimeListenerIf
See Also:
PsAnimation, PsTimeListenerIf

improveUnfolding

public boolean improveUnfolding()
Method to reduce the number of components the unfolding consists of. The method unfold must be called in advance.

Returns:
boolean true is the number of components has been reduces, false if not.

isRunning

public boolean isRunning()
Check whether smoothing prcess will be stopped.

Returns:
false, if the energy minimizer will stop (just shutting down regularely).

isStopped

public boolean isStopped()
Check whether smoothing prcess 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.

See Also:
start()

run

public void run()
Specified by:
run in interface java.lang.Runnable

selectGeometry

public void selectGeometry(PgGeometryIf geom)
Currently not supported by display.

Specified by:
selectGeometry in interface PvPickListenerIf

pickDisplay

public void pickDisplay(PvPickEvent pos)
Get a location in the display with 2d display and 3d world coordinates. Point may be independent of any geometry.

Specified by:
pickDisplay in interface PvPickListenerIf
Parameters:
pos - Pick event issued by the display
See Also:
PvPickListenerIf

dragDisplay

public void dragDisplay(PvPickEvent pos)
Drag a location in the display with 2d display and 3d world coordinates. Point may be independent of any geometry.

Specified by:
dragDisplay in interface PvPickListenerIf
Parameters:
pos - Pick event issued by the display
See Also:
PvPickListenerIf

pickInitial

public void pickInitial(PvPickEvent pos)
Pick an arbitrary point on a geometry, point may lie inside an element.

Specified by:
pickInitial in interface PvPickListenerIf
Parameters:
pos - Pick event issued by the display
See Also:
PvPickListenerIf

dragInitial

public void dragInitial(PvPickEvent pos)
Drag an arbitrary point along a geometry, point may lie inside an element.

Specified by:
dragInitial in interface PvPickListenerIf
Parameters:
pos - Pick event issued by the display
See Also:
PvPickListenerIf

pickVertex

public void pickVertex(PgGeometryIf geom,
                       int index,
                       PdVector vertex)
Get a picked vertex of a geometry.

Specified by:
pickVertex in interface PvPickListenerIf
Parameters:
geom - Picked geometry on which vertex lies
index - Index of vertex in vertex array of geometry
vertex - 3d coordinates of vertex position
See Also:
PvPickListenerIf

dragVertex

public void dragVertex(PgGeometryIf geom,
                       int index,
                       PdVector vertex)
Drag a picked vertex of a geometry.

Specified by:
dragVertex in interface PvPickListenerIf
Parameters:
geom - Picked geometry on which vertex lies
index - Index of vertex in vertex array of geometry
vertex - 3d coordinates of vertex position

markVertices

public void markVertices(PvPickEvent pos)
Mark a set of vertices of a geometry within a given bounding box.

Specified by:
markVertices in interface PvPickListenerIf
Parameters:
pos - contains four coplanar points on the bounding prism, and direction of prism.
See Also:
PvPickEvent.getMarkBox()

unmarkVertices

public void unmarkVertices(PvPickEvent pos)
Unmark a set of vertices of a geometry within a given bounding box.

Specified by:
unmarkVertices in interface PvPickListenerIf
Parameters:
pos - contains four coplanar points on the bounding prism, and direction of prism.
See Also:
PvPickEvent.getMarkBox()

JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.