JavaView® v2.12

jvx.geom
Class PwGeodesic

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jvx.geom.PwGeodesic
All Implemented Interfaces:
java.lang.Cloneable, PsUpdateIf, PvPickListenerIf, java.io.Serializable

public class PwGeodesic
extends PsObject
implements PvPickListenerIf

Workshop for the computation of shortest geodesics that connect two given points on an element set. Can be used as numerics library by use of static method getShortest(...) or as a workshop by making an instance of PwGeodesic and registering a geometry and a display. Pick events will be caught in the second case and the curve automatically computed. You can access the computed curve by method getPolygon(). After using the workshop you have to call close() to tidy things up!

Version:
19.09.01, 2.30 revised (ep) New cancel/ok behaviour.
30.08.01, 2.20 revised (ep) Added various methods.
26.07.01, 2.10 revised (ep) Bug removed ('listener already used').
16.02.01, 2.00 revised (ep) Added functionality of straightest geodesics.
See Also:
Serialized Form

Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, NUM_TAGS
 
Constructor Summary
PwGeodesic()
           
 
Method Summary
 void cancel()
           
 void close()
          Has to be called to remove workshop from element set as update listener and to remove polygon from display.
 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.
 PvDisplayIf getDisplay()
          Display where geodesics are shown and where pick events are caught from.
 PgElementSet getGeometry()
          Geodesics are computed on this surface.
 java.lang.String getName()
          The name of a listeners allows the display to issue verbal debug messages.
 PgPolygon getPolygon()
          The computed geodesic as an independent n-dimensional polygon.
 PgPolygonOnElementSet getPolygonOnElementSet()
          The computed geodesic as a polygon that depends on the geometry.
static PgPolygonOnElementSet getShortest(PgElementSet geom, PdBary start, int startelem, PdBary end, int endelem)
          Computes a shortest geodesic that connects given points on a triangulation.
static PgPolygon[] getShortestInStrip(PgElementSet geom, PdBary start, PdBary end, int[] strip, PiVector outSide, PiVector outvertind, PdBaryDir initialDir)
          Computes the shortest polygon between two points that lies in elements that is given as parameter.
 void init()
          Sets the default length, angle and method.
 void markVertices(PvPickEvent pos)
          Mark a set of vertices of a geometry within a given bounding box.
 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 selectGeometry(PgGeometryIf geom)
          Currently not supported by display.
 void setDisplay(PvDisplayIf disp)
          Sets the display where the resulting geodesic shall be shown.
 void setEndBary(PdBary bary)
          Set the endpoint of the geodesic.
 void setEndElement(int elemindex)
          Set the element where the geodesic shall end in.
 void setGeometry(PgElementSet elemset)
          Geodesics are computed on the given surface.
 void setMethodStraightest()
          Compute STRAIGHTEST geodesics.
 void setPickFirst()
          User shall pick starting point.
 void setPickLast()
          User shall pick endpoint.
 void setStartBary(PdBary bary)
          Set the starting point of the geodesic.
 void setStartElement(int elemindex)
          Set the element where the geodesic shall start in.
 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 jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, toString, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PwGeodesic

public PwGeodesic()
Method Detail

init

public void init()
Sets the default length, angle and method. Does not remove the settings for the geometry or display.
Overrides:
init in class PsObject

setGeometry

public void setGeometry(PgElementSet elemset)
Geodesics are computed on the given surface. Sets starting element and endelement to default values that fit the geometry.
Parameters:
elemset - must be a triangulation! may be null to indicate that the geometry settings of this workshop shall be removed.

getGeometry

public PgElementSet getGeometry()
Geodesics are computed on this surface.
Returns:
geometry that was set by setGeometry(PgElementSet)

setDisplay

public void setDisplay(PvDisplayIf disp)
Sets the display where the resulting geodesic shall be shown. Pick events are caught from this display also.
Parameters:
disp - may be null - then the geodesic is not shown anywhere (default)

getDisplay

public PvDisplayIf getDisplay()
Display where geodesics are shown and where pick events are caught from.
Returns:
display that was set with setDisplay(PvDisplayIf)

close

public void close()
Has to be called to remove workshop from element set as update listener and to remove polygon from display.

cancel

public void cancel()

getPolygon

public PgPolygon getPolygon()
The computed geodesic as an independent n-dimensional polygon. Is always the same instance of PgPolygon.
Returns:
 

getPolygonOnElementSet

public PgPolygonOnElementSet getPolygonOnElementSet()
The computed geodesic as a polygon that depends on the geometry. Is always a new one for each computation.

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.
Overrides:
update in class PsObject
Following copied from class: jv.object.PsObject
See Also:
PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)

getName

public java.lang.String getName()
The name of a listeners allows the display to issue verbal debug messages.
Specified by:
getName in interface PvPickListenerIf
Overrides:
getName in class PsObject

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:
markBox - contains four coplanar points on the bounding prism, and direction of prism.

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:
markBox - contains four coplanar points on the bounding prism, and direction of prism.

setPickFirst

public void setPickFirst()
User shall pick starting point.

setPickLast

public void setPickLast()
User shall pick endpoint.

setStartBary

public void setStartBary(PdBary bary)
Set the starting point of the geodesic.
Parameters:
bary - 3dim barycentric coordinates of starting point in start element
See Also:
setStartElement(int)

setStartElement

public void setStartElement(int elemindex)
Set the element where the geodesic shall start in.
See Also:
setStartBary(PdBary)

setEndBary

public void setEndBary(PdBary bary)
Set the endpoint of the geodesic.
Parameters:
bary - 3dim barycentric coordinates of endpoint in endelement
See Also:
setEndElement(int)

setEndElement

public void setEndElement(int elemindex)
Set the element where the geodesic shall end in.
See Also:
setEndBary(PdBary)

setMethodStraightest

public void setMethodStraightest()
Compute STRAIGHTEST geodesics.

getShortestInStrip

public static PgPolygon[] getShortestInStrip(PgElementSet geom,
                                             PdBary start,
                                             PdBary end,
                                             int[] strip,
                                             PiVector outSide,
                                             PiVector outvertind,
                                             PdBaryDir initialDir)
Computes the shortest polygon between two points that lies in elements that is given as parameter. It lays the elements into a plane and uses another method to get the points of the curve.
Parameters:
start - barycentric coordinates of starting point in element strip[0]
end - barycentric coordinates of endpoint in element strip[strip.length-1]
strip - array that contains the global element indices of the elements that shall be traversed on the way from start to end. Must contain the elements in the order in which they shall be traversed.
outSide - output: contains numbers {0,1}. outSide.getEntry(i)==0 if i-th vertex (exclusive starting and endpoint) of shortest polygon lies on left border. ==1 if i-th vertex (exclusive starting and endpoint) of shortest polygon lies on right border.
outvertind - output: global vertex index in element set of the geometry vertex that the polygon hits with its vertex
initialDir - output: initial barycentric direction of shortest polygon in element strip[0]
Returns:
list of 2-dim polygons:
[0]= left border of element strip
[1]= right border of element strip
[2]= shortest polygon
returns null if an error occured or if strip containes of only one element

getShortest

public static PgPolygonOnElementSet getShortest(PgElementSet geom,
                                                PdBary start,
                                                int startelem,
                                                PdBary end,
                                                int endelem)
Computes a shortest geodesic that connects given points on a triangulation. That doesn't have to be THE shortest connection between the points.
Parameters:
geom - The element set. Must have valid neighourhood information and must be triangulated.
start - Barycentric coordinates of starting point in starting element
startelem - The starting element. Global index in geometry.
end - Barycentric coordinates of endpoint in endelement
endelem - The endelement. Global index in geometry.
Returns:
A shortest connection between starting and endpoint as a polygon on element set, or null if an error occured.
See Also:
PgPolygonOnElementSet

JavaView® v2.12

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