public class PwGeodesic extends PjWorkshop implements PvPickListenerIf
getShortest(...)
is used, or as a workshop by creating 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 use as a workshop you need
to call close()
to tidy things up!Modifier and Type  Field and Description 

static int 
SHORTEST
Method is set to this if pick events shall
result in computation of shortest geodesics. 
static int 
SHORTEST_DIJKSTRA
Initial triangle run for SHORTEST is selected by smallest facedijkstra distance.

static int 
SHORTEST_DIJKSTRA_REUSE
Initial triangle run for SHORTEST is selected by smallest facedijkstra distance if new end/start face is not neighbouring old end/start face.

static int 
SHORTEST_ELEMENT_TREE
Initial triangle run for SHORTEST is selected by smallest facedijkstra distance.

static int 
SHORTEST_EUCL_DIJKSTRA
Initial triangle run for SHORTEST is selected by smallest euclidean facedijkstra distance.

static int 
STRAIGHTEST
Method is set to this if pick events shall
result in computation straightest geodesics. 
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
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
Constructor and Description 

PwGeodesic() 
Modifier and Type  Method and Description 

void 
cancel()
Cancels and closes the workshop (removing the computed geodesic from display).

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

void 
computeWay()
Initiates recalculation of geodesic.

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.

double 
getActualLength()
The current actual length of the computed geodesic.

double 
getAngle() 
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.

static PiVector 
getDijkstraDistance(PgElementSet geom,
PiVector front)
Computes the combinatorial edge distance of all vertices to a given center vertex
respectively on a given set of vertices using Dijkstra's algorithm.

PvDisplayIf 
getDisplay()
Display where geodesics are shown and where pick events are caught from.

static PgVectorField 
getEuclideanDijkstraDistance(PgElementSet geom,
PiVector front,
PgVectorField distance)
Computes the edge distance of all vertices to a given center vertex
respectively on a given set of vertices using Dijkstra's algorithm.

int 
getMethod()
Whether shortest or straightest geodesics are computed.

PgPolygon 
getPolygon()
The computed geodesic as an independent ndimensional 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 PgPolygonOnElementSet 
getShortest(PgElementSet geom,
PdBary start,
int startelem,
PdBary end,
int endelem,
PiVector trianglerun,
PgPolygonOnElementSet outpoly)
Computes a shortest geodesic that connects given points on a triangulation.

static PgPolygonOnElementSet 
getShortest(PgElementSet geom,
PdBary start,
int startelem,
PdBary end,
int endelem,
PiVector trianglerun,
PgPolygonOnElementSet outpoly,
PgElementSet unfolded,
PiVector vertexlist,
PiVector left,
PiVector right,
PdVector previous,
PdVector next,
PdVector t2d,
PdBary tempbary)
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)
Deprecated.
since 06.05.04, use
getShortestInUnfoldedTriangleRun(...) instead. 
static PiVector 
getShortestInUnfoldedTriangleRun(PgElementSet unfolded,
PiVector left,
PiVector right,
PiVector output)
Takes a triangle run (unfolded to 2d) and computes the shortest connection in this
closed polygon between the start and end vertex.

int 
getShortestMode()
If shortest geodesics are computed, you have several different choices which local
minimum is computed.

void 
init()
Sets the default length, angle and method.

static boolean 
isConnected(PiVector[] neighb,
PiVector elementrun)
Checks whether the given element indices belong to an edge connected element run.

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 
removeGeometry()
Remove the assigned geometry and its backup clone.

static int 
removeLoops(int[] source,
int len,
int[] temp)
Removes subintervals with same starting and ending value (processing from left to right),
for instance 10,9,5,7,2,10,2 becomes 10,2

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

void 
setAngle(double angle) 
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 
setMethod(int mode)
Set whether shortest or straightest geodesics are computed.

void 
setPickFirst()
User shall pick starting point.

void 
setPickLast()
User shall pick endpoint.

void 
setShortestMode(int flag)
If shortest geodesics are computed, you have several different choices which local
minimum is computed.

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 
showWay()
Deprecated.
Use
computeWay() instead. 
static PiVector 
unfoldTriangleRun(PgElementSet geom,
PiVector run,
PgElementSet unfolded,
PiVector left,
PiVector right)
Triangle number i in given run is triangle i in unfolded 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.

getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, openDialog, reset, setDisplays, setGeometry, setModal, setMode, setStandalone, setViewer
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
getName
getFather, getName, setParent
public static final int SHORTEST
Method
is set to this if pick events shall
result in computation of shortest geodesics.public static final int STRAIGHTEST
Method
is set to this if pick events shall
result in computation straightest geodesics.public static final int SHORTEST_DIJKSTRA
public static final int SHORTEST_DIJKSTRA_REUSE
public static final int SHORTEST_EUCL_DIJKSTRA
public static final int SHORTEST_ELEMENT_TREE
public void init()
init
in class PjWorkshop
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PjWorkshop
event
 sender of this update.PsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public void showWay()
computeWay()
instead.public void computeWay()
update(this)
to make things visible.public void setGeometry(PgElementSet elemset)
Triangulates the geometry and removes degenerated faces if necessary.
Call computeWay()
to compute default geodesic.
elemset
 Is triangulated if necessary. cancel()
returns element set to nontriangulated state in this case.public void removeGeometry()
PjWorkshop
removeGeometry
in class PjWorkshop
public double getActualLength()
public void setDisplay(PvDisplayIf disp)
setDisplay
in interface PjWorkshopIf
setDisplay
in class PjWorkshop
disp
 may be null  then the geodesic is not shown anywhere (default)public PvDisplayIf getDisplay()
getDisplay
in interface PjWorkshopIf
getDisplay
in class PjWorkshop
setDisplay(PvDisplayIf)
public void close()
close
in class PjWorkshop
public void cancel()
cancel
in class PjWorkshop
public void ok()
PjWorkshop
Implementation in this class calls close()
.
ok
in class PjWorkshop
public PgPolygon getPolygon()
public PgPolygonOnElementSet getPolygonOnElementSet()
public void selectGeometry(PgGeometryIf geom)
selectGeometry
in interface PvPickListenerIf
geom
 Now selected geometry of display.public void pickDisplay(PvPickEvent pos)
pickDisplay
in interface PvPickListenerIf
pos
 Pick event issued by the displayPvPickListenerIf
public void dragDisplay(PvPickEvent pos)
dragDisplay
in interface PvPickListenerIf
pos
 Pick event issued by the displayPvPickListenerIf
public void pickInitial(PvPickEvent pos)
pickInitial
in interface PvPickListenerIf
pos
 Pick event issued by the displayPvPickListenerIf
public void dragInitial(PvPickEvent pos)
dragInitial
in interface PvPickListenerIf
pos
 Pick event issued by the displayPvPickListenerIf
public void pickVertex(PgGeometryIf geom, int index, PdVector vertex)
pickVertex
in interface PvPickListenerIf
geom
 Picked geometry on which vertex liesindex
 Index of vertex in vertex array of geometryvertex
 3d coordinates of vertex positionPvPickListenerIf
public void dragVertex(PgGeometryIf geom, int index, PdVector vertex)
dragVertex
in interface PvPickListenerIf
geom
 Picked geometry on which vertex liesindex
 Index of vertex in vertex array of geometryvertex
 3d coordinates of vertex positionpublic void markVertices(PvPickEvent pos)
markVertices
in interface PvPickListenerIf
pos
 Contains mark box that is selected.public void unmarkVertices(PvPickEvent pos)
unmarkVertices
in interface PvPickListenerIf
pos
 Contains mark box that is selected.public void setPickFirst()
update(this)
is needed afterwards.public void setPickLast()
update(this)
is needed afterwards.public void setMethod(int mode)
computeWay()
and update(this)
for changes to take effect.SHORTEST
,
STRAIGHTEST
public int getMethod()
SHORTEST
or
STRAIGHTEST
.setMethod(int)
public void setShortestMode(int flag)
flag
 SHORTEST_DIJKSTRA
,
SHORTEST_EUCL_DIJKSTRA
,
SHORTEST_ELEMENT_TREE
public int getShortestMode()
public void setAngle(double angle)
public double getAngle()
public void setStartBary(PdBary bary)
bary
 3dim barycentric coordinates of starting point in start elementsetStartElement(int)
public void setStartElement(int elemindex)
setStartBary(PdBary)
public void setEndBary(PdBary bary)
bary
 3dim barycentric coordinates of endpoint in endelementsetEndElement(int)
public void setEndElement(int elemindex)
setEndBary(PdBary)
public static boolean isConnected(PiVector[] neighb, PiVector elementrun)
neighb
 neighbourhood information of geometryelementrun
 list of element indicesPgElementSet.getNeighbours()
public static int[] getConnectingStrip(PgElementSet geom, int startelem, int endelem)
public static PgPolygon[] getShortestInStrip(PgElementSet geom, PdBary start, PdBary end, int[] strip, PiVector outSide, PiVector outvertind, PdBaryDir initialDir)
getShortestInUnfoldedTriangleRun(...)
instead.start
 barycentric coordinates of starting point in element strip[0]end
 barycentric coordinates of endpoint in element strip[strip.length1]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 ith vertex
(excluding starting and endpoint) of shortest polygon
lies on left border. ==1 if ith 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 vertexinitialDir
 output: initial barycentric direction of shortest polygon in element strip[0]public static PgPolygonOnElementSet getShortest(PgElementSet geom, PdBary start, int startelem, PdBary end, int endelem)
NOTE: The element indices are always of the following form: first element is the starting element, then given a polygon vertex the next vertex has an element assigned that is a neighbour to the element of the current vertex, except the next vertex lies on a vertex.
geom
 The element set. Must have valid neighourhood information and must be triangulated.start
 Barycentric coordinates of starting point in starting elementstartelem
 The starting element. Global index in geometry. Note that the first element of the
computed geodesic may be different from this parameter if startpoint lies on a vertex.end
 Barycentric coordinates of endpoint in endelementendelem
 The endelement. Global index in geometry. Note that the last element of the
computed geodesic may be different from this parameter if endpoint lies on a vertex.PgPolygonOnElementSet
public static PgPolygonOnElementSet getShortest(PgElementSet geom, PdBary start, int startelem, PdBary end, int endelem, PiVector trianglerun, PgPolygonOnElementSet outpoly)
NOTE: The element indices are always of the following form: first element is the starting element, then given a polygon vertex the next vertex has an element assigned that is a neighbour to the element of the current vertex, except the next vertex lies on a vertex.
geom
 The element set. Must have valid neighourhood information and must be triangulated. Must NOT have degenerate edges.start
 Barycentric coordinates of starting point in starting elementstartelem
 The starting element. Global index in geometry. Note that the first element of the
computed geodesic may be different from this parameter if startpoint lies on a vertex.end
 Barycentric coordinates of endpoint in endelementendelem
 The endelement. Global index in geometry. Note that the last element of the
computed geodesic may be different from this parameter if endpoint lies on a vertex.trianglerun
 A list of connected triangles from startelem to endelem, that will be used as the first guess. May be null.
As output: The triangle run which contains the computed geodesic is returned here.outpoly
 Result is put here if not null. New polygon is allocated if null. Is returned as function value.PgPolygonOnElementSet
public static PgPolygonOnElementSet getShortest(PgElementSet geom, PdBary start, int startelem, PdBary end, int endelem, PiVector trianglerun, PgPolygonOnElementSet outpoly, PgElementSet unfolded, PiVector vertexlist, PiVector left, PiVector right, PdVector previous, PdVector next, PdVector t2d, PdBary tempbary)
NOTE: The element indices are always of the following form: first element is the starting element, then given a polygon vertex the next vertex has an element assigned that is a neighbour to the element of the current vertex, except the next vertex lies on a vertex.
geom
 The element set. Must have valid neighourhood information and must be triangulated. Must NOT have degenerate edges.start
 Barycentric coordinates of starting point in starting elementstartelem
 The starting element. Global index in geometry. Note that the first element of the
computed geodesic may be different from this parameter if startpoint lies on a vertex.end
 Barycentric coordinates of endpoint in endelementendelem
 The endelement. Global index in geometry. Note that the last element of the
computed geodesic may be different from this parameter if endpoint lies on a vertex.trianglerun
 A list of connected triangles from startelem to endelem, that will be used as the first guess. May be null.
As output: The triangle run which contains the computed geodesic is returned here.outpoly
 Result is put here if not null. New polygon is allocated if null. Is returned as function value.unfolded
 temporary 2d geometry for unfolded triangle runs; may be null.vertexlist
 variable size temporary container, references to left and right boundary in unfolded geometry; may be null.left
 variable size temporary container for left unfolded boundary; may be null.right
 variable size temporary container for right unfolded boundary; may be null.previous
 temporary 2d vector; may be null.next
 temporary 2d vector; may be null.t2d
 temporary 2d vector; may be null.tempbary
 temporary barycentric coordinates in a triangle; may be null.PgPolygonOnElementSet
public static PiVector unfoldTriangleRun(PgElementSet geom, PiVector run, PgElementSet unfolded, PiVector left, PiVector right)
geom.getElement(run.getEntry(i)).getEntry(k)
is unfolded to
unfolded.getElement(i).getEntry(k)
.)
The generated geometry has no neighbourhood information or normals.
geom
 a triangulation with dimOfVertices >= 3; may not contain degenerate edgesrun
 must have length >= 1 and must be a connected list of triangles in geomunfolded
 output is a 2d geometryleft
 left and right contain vertex indices in unfolded geometry
where left[i],right[i] is the ith diagonal. I.e. both can contain
intervals i,i+k with identical indices that represent the same point on the bounds of unfolded.
They include both initial and endvertex.right
 see leftpublic static PiVector getShortestInUnfoldedTriangleRun(PgElementSet unfolded, PiVector left, PiVector right, PiVector output)
unfoldTriangleRun(...)
to get the data needed by this method from a higher dimensional
surface.unfolded
 2d triangle runleft
 Sequence of vertex indices in 'unfolded' that describe the left hand boundary
of the run. It implicitely contains information about the behaviour of
the diagonals (inner edges): A boundary vertex with N diagonals emanating
from it is repeated N times in sequence. The sequence contains the
first and last vertex of the triangle run exactly once.right
 same as 'left' for the right hand boundaryoutput
 contains indices for left/right arrays of the vertices that are hit.
negative index refers to right array, positive to left arraypublic static PiVector getDijkstraDistance(PgElementSet geom, PiVector front)
geom
 The element set. Neighourhood information is not needed.front
 Indices of vertices on the initial front.public static int removeLoops(int[] source, int len, int[] temp)
source
 inout (source with loops removed is put here)len
 number of entries in source to be consideredtemp
 should be of length >= max_{i}(source[i]) (no check performed)public static PgVectorField getEuclideanDijkstraDistance(PgElementSet geom, PiVector front, PgVectorField distance)
"