JavaView® v2.00.008

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 getCurve().

See Also:
Serialized Form

Field Summary
protected  PvDisplayIf m_disp
           
protected  PdBary m_endbary
           
protected  PuInteger m_endElem
           
protected  PgElementSet m_geom
           
protected  boolean m_pick
           
protected  boolean m_pickFirst
           
protected  PgPolygon m_poly
           
protected  PdBary m_startbary
           
protected  PuInteger m_startElem
           
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Constructor Summary
PwGeodesic()
           
 
Method Summary
 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.
protected  void fixpolygon()
           
protected static int[] getConnectingStrip(PgElementSet geom, int startelem, int endelem)
          Gets a strip from startelem to endelem by marking the elements (beginning with startelem) and their neighbours with the 'distance' to the starting element (measured in 'number of elements') until the endelement is reached.
 java.lang.String getName()
          The name of a listeners allows the display to issue verbal debug messages.
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()
          If instance has missing name then assign default name 'object_NUMBER' where number is the total number of already created instances.
 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)
           
 void setGeometry(PgElementSet elemset)
           
 void setPickFirst()
           
 void setPickLast()
           
protected  void showWay(int startelem, PdBary startbary, int endelem, PdBary endbary)
           
 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, 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, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_geom

protected PgElementSet m_geom

m_disp

protected PvDisplayIf m_disp

m_startElem

protected PuInteger m_startElem

m_endElem

protected PuInteger m_endElem

m_startbary

protected PdBary m_startbary

m_endbary

protected PdBary m_endbary

m_poly

protected PgPolygon m_poly

m_pickFirst

protected boolean m_pickFirst

m_pick

protected boolean m_pick
Constructor Detail

PwGeodesic

public PwGeodesic()
Method Detail

init

public void init()
Description copied from class: PsObject
If instance has missing name then assign default name 'object_NUMBER' where number is the total number of already created instances.
Overrides:
init in class PsObject

setGeometry

public void setGeometry(PgElementSet elemset)

setDisplay

public void setDisplay(PvDisplayIf disp)

close

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

fixpolygon

protected void fixpolygon()

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

showWay

protected void showWay(int startelem,
                       PdBary startbary,
                       int endelem,
                       PdBary endbary)

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()

setPickLast

public void setPickLast()

getConnectingStrip

protected static int[] getConnectingStrip(PgElementSet geom,
                                          int startelem,
                                          int endelem)
Gets a strip from startelem to endelem by marking the elements (beginning with startelem) and their neighbours with the 'distance' to the starting element (measured in 'number of elements') until the endelement is reached. Then the algorithm constructs a way by going backwards from endelement to elements with decreasing distance.

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.
See Also:
PgPolygonOnElementSet

JavaView® v2.00.008

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