Class PwGeodesic
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.project.PjWorkshop
-
- jvx.geom.PwGeodesic
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PjWorkshopIf, PvPickListenerIf
public class PwGeodesic extends PjWorkshop implements PvPickListenerIf
Workshop for the computation of shortest and straightest geodesics that connect two given points on an element set. Can be used as numerics library if only static methodgetShortest(...)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 methodgetPolygon(). After use as a workshop you need to callclose()to tidy things up!- See Also:
- Serialized Form
- Author:
- Eike Preuß
- Version:
- 13.12.13, 3.60 revised (kp) Internal variable m_disp removed, superclass m_display used instead.
17.10.13, 3.50 revised (fr) Add functionality of homotopic geodesic.
01.03.06, 3.40 revised (ah) Use PnStraightestGeodesic.
06.05.04, 3.30 revised (ep) Complete rewrite of getShortest method. Problems with boundary, loops and vertices as start or end coordinates should are solved.
26.04.04, 3.20 revised (ep) Different methods for construction of triangle run for shortest method.
03.07.03, 3.10 revised (ep) MadeshowWay()public.
19.06.03, 3.00 revised (ep) Removed bug in 2d that miscalculated the angle of shortest geodesics.
18.12.02, 2.90 revised (ep) Turn on edges.
06.02.02, 2.80 revised (ep) New label for measured length, don't reduce max. length at boundary, update geodesic at setGeometry.
24.01.02, 2.70 revised (ep) Removed bugs that appeared with new workshop handling.
23.01.02, 2.60 revised (ep) Internationalization.
29.12.01, 2.50 revised (kp) Minor revision of updates when using new workshop handling.
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.
-
-
Field Summary
Fields Modifier and Type Field and Description static intSHORTESTMethodis set to this if pick events shall result in computation of shortest geodesics.static intSHORTEST_DIJKSTRAInitial triangle run for SHORTEST is selected by smallest face-dijkstra distance.static intSHORTEST_DIJKSTRA_HOMOTOPICInitial triangle run for SHORTEST is selected from the previous triangle run and extended to the next coordinate pointstatic intSHORTEST_DIJKSTRA_REUSEInitial triangle run for SHORTEST is selected by smallest face-dijkstra distance if new end/start face is not neighbouring old end/start face.static intSHORTEST_ELEMENT_TREEInitial triangle run for SHORTEST is selected by smallest face-dijkstra distance.static intSHORTEST_EUCL_DIJKSTRAInitial triangle run for SHORTEST is selected by smallest Euclidean face-dijkstra distance.static intSTRAIGHTESTMethodis set to this if pick events shall result in computation straightest geodesics.-
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 PwGeodesic()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidcancel()Cancels and closes the workshop (removing the computed geodesic from display).voidclose()Has to be called to remove workshop from element set as update listener and to remove polygon from display.voidcomputeWay()Initiates re-calculation of geodesic.voiddragDisplay(PvPickEvent pos)Drag a location in the display with 2d display and 3d world coordinates.voiddragInitial(PvPickEvent pos)Drag an arbitrary point along a geometry, point may lie inside an element.voiddragVertex(PgGeometryIf geom, int index, PdVector vertex)Drag a picked vertex of a geometry.doublegetActualLength()The current actual length of the computed geodesic.doublegetAngle()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 PiVectorgetDijkstraDistance(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.static PgVectorFieldgetEuclideanDijkstraDistance(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.intgetMethod()Whether shortest or straightest geodesics are computed.PgPolygongetPolygon()The computed geodesic as an independent n-dimensional polygon.PgPolygonOnElementSetgetPolygonOnElementSet()The computed geodesic as a polygon that depends on the geometry.static PgPolygonOnElementSetgetShortest(PgElementSet geom, PdBary start, int startelem, PdBary end, int endelem)Computes a shortest geodesic that connects given points on a triangulation.static PgPolygonOnElementSetgetShortest(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 PgPolygonOnElementSetgetShortest(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, usegetShortestInUnfoldedTriangleRun(...)instead.static PiVectorgetShortestInUnfoldedTriangleRun(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.intgetShortestMode()If shortest geodesics are computed, you have several different choices which local minimum is computed.voidinit()Sets the default length, angle and method.static booleanisConnected(PiVector[] neighb, PiVector elementrun)Checks whether the given element indices belong to an edge connected element run.voidmarkVertices(PvPickEvent pos)Mark a set of vertices of a geometry within a given bounding box.voidok()Accept current version of the geometry as new version.voidpickDisplay(PvPickEvent pos)Get a location in the display with 2d display and 3d world coordinates.voidpickInitial(PvPickEvent pos)Pick an arbitrary point on a geometry, point may lie inside an element.voidpickVertex(PgGeometryIf geom, int index, PdVector vertex)Get a picked vertex of a geometry.voidremoveGeometry()Remove the assigned geometry and its backup clone.static intremoveLoops(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,2voidselectGeometry(PgGeometryIf geom)Currently not supported by display.voidsetAngle(double angle)voidsetDisplay(PvDisplayIf disp)Sets the display where the resulting geodesic shall be shown.voidsetEndBary(PdBary bary)Set the endpoint of the geodesic.voidsetEndElement(int elemindex)Set the element where the geodesic shall end in.voidsetGeometry(PgElementSet elemset)Geodesics are computed on the given surface.voidsetMethod(int mode)Set whether shortest or straightest geodesics are computed.voidsetPickFirst()User shall pick starting point.voidsetPickLast()User shall pick endpoint.voidsetShortestMode(int flag)If shortest geodesics are computed, you have several different choices which local minimum is computed.voidsetStartBary(PdBary bary)Set the starting point of the geodesic.voidsetStartElement(int elemindex)Set the element where the geodesic shall start in.voidshowWay()Deprecated.UsecomputeWay()instead.static PiVectorunfoldTriangleRun(PgElementSet geom, PiVector run, PgElementSet unfolded, PiVector left, PiVector right)Triangle number i in given run is triangle i in unfolded geometry.voidunmarkVertices(PvPickEvent pos)Unmark a set of vertices of a geometry within a given bounding box.booleanupdate(java.lang.Object event)Update the class whenever a child has changed.-
Methods inherited from class jvx.project.PjWorkshop
getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, reset, 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.project.PvPickListenerIf
getName
-
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
-
-
-
-
Field Detail
-
SHORTEST
public static final int SHORTEST
Methodis set to this if pick events shall result in computation of shortest geodesics.- See Also:
- Constant Field Values
-
STRAIGHTEST
public static final int STRAIGHTEST
Methodis set to this if pick events shall result in computation straightest geodesics.- See Also:
- Constant Field Values
-
SHORTEST_DIJKSTRA
public static final int SHORTEST_DIJKSTRA
Initial triangle run for SHORTEST is selected by smallest face-dijkstra distance.- See Also:
- Constant Field Values
-
SHORTEST_DIJKSTRA_REUSE
public static final int SHORTEST_DIJKSTRA_REUSE
Initial triangle run for SHORTEST is selected by smallest face-dijkstra distance if new end/start face is not neighbouring old end/start face.- See Also:
- Constant Field Values
-
SHORTEST_EUCL_DIJKSTRA
public static final int SHORTEST_EUCL_DIJKSTRA
Initial triangle run for SHORTEST is selected by smallest Euclidean face-dijkstra distance.- See Also:
- Constant Field Values
-
SHORTEST_ELEMENT_TREE
public static final int SHORTEST_ELEMENT_TREE
Initial triangle run for SHORTEST is selected by smallest face-dijkstra distance.- See Also:
- Constant Field Values
-
SHORTEST_DIJKSTRA_HOMOTOPIC
public static final int SHORTEST_DIJKSTRA_HOMOTOPIC
Initial triangle run for SHORTEST is selected from the previous triangle run and extended to the next coordinate point- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init()
Sets the default length, angle and method. Does not remove the settings for the geometry or display.- 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)- Version:
- 16.04.04, revised (ep) Update(this) implemented.
-
showWay
public void showWay()
Deprecated. UsecomputeWay()instead.Initiates re-calculation of geodesic and shows the result in the given display.
-
computeWay
public void computeWay()
Initiates re-calculation of geodesic. You need to callupdate(this)to make things visible.
-
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.Triangulates the geometry and removes degenerated faces if necessary.
CallcomputeWay()to compute default geodesic.- Parameters:
elemset- Is triangulated if necessary.cancel()returns element set to non-triangulated state in this case.- Version:
- 14.10.06, 1.20 revised (kp) Computing element normals when missing or disabled.
16.04.04, 1.10 revised (ep) Triangulates geometry if necessary.
-
removeGeometry
public void removeGeometry()
Description copied from class:PjWorkshopRemove the assigned geometry and its backup clone. Subclasses frequently overwrite this method but are advised to call this method.- Overrides:
removeGeometryin classPjWorkshop
-
getActualLength
public double getActualLength()
The current actual length of the computed geodesic.- Returns:
- -1 if no geodesic is visible
-
setDisplay
public void setDisplay(PvDisplayIf disp)
Sets the display where the resulting geodesic shall be shown. Pick events are caught from this display also.- Specified by:
setDisplayin interfacePjWorkshopIf- Overrides:
setDisplayin classPjWorkshop- Parameters:
disp- may be null - then the geodesic is not shown anywhere (default)
-
close
public void close()
Has to be called to remove workshop from element set as update listener and to remove polygon from display.- Overrides:
closein classPjWorkshop
-
cancel
public void cancel()
Cancels and closes the workshop (removing the computed geodesic from display).- Overrides:
cancelin classPjWorkshop
-
ok
public void ok()
Description copied from class:PjWorkshopAccept current version of the geometry as new version. Close workshop. The copy of the original geometry is ignored.Implementation in this class calls
close().- Overrides:
okin classPjWorkshop
-
getPolygon
public PgPolygon getPolygon()
The computed geodesic as an independent n-dimensional polygon. Is always the same instance of PgPolygon.- Returns:
- computed geodesic as polygon.
-
getPolygonOnElementSet
public PgPolygonOnElementSet getPolygonOnElementSet()
The computed geodesic as a polygon that depends on the geometry. Is always a new one for each computation.
-
selectGeometry
public void selectGeometry(PgGeometryIf geom)
Currently not supported by display.- Specified by:
selectGeometryin interfacePvPickListenerIf- Parameters:
geom- Now selected geometry of display.
-
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:
pickDisplayin interfacePvPickListenerIf- 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:
dragDisplayin interfacePvPickListenerIf- 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:
pickInitialin interfacePvPickListenerIf- 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:
dragInitialin interfacePvPickListenerIf- 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:
pickVertexin interfacePvPickListenerIf- Parameters:
geom- Picked geometry on which vertex liesindex- Index of vertex in vertex array of geometryvertex- 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:
dragVertexin interfacePvPickListenerIf- Parameters:
geom- Picked geometry on which vertex liesindex- Index of vertex in vertex array of geometryvertex- 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:
markVerticesin interfacePvPickListenerIf- Parameters:
pos- Contains mark box that is selected.
-
unmarkVertices
public void unmarkVertices(PvPickEvent pos)
Unmark a set of vertices of a geometry within a given bounding box.- Specified by:
unmarkVerticesin interfacePvPickListenerIf- Parameters:
pos- Contains mark box that is selected.
-
setPickFirst
public void setPickFirst()
User shall pick starting point. Call ofupdate(this)is needed afterwards.
-
setPickLast
public void setPickLast()
User shall pick endpoint. Call ofupdate(this)is needed afterwards.
-
setMethod
public void setMethod(int mode)
Set whether shortest or straightest geodesics are computed. Use the constants of this workshop. You need to callcomputeWay()andupdate(this)for changes to take effect.- See Also:
SHORTEST,STRAIGHTEST- Version:
- 16.04.04, 1.10 created (ep) Created from setMethodShortest and setMethodStraightest.
-
getMethod
public int getMethod()
Whether shortest or straightest geodesics are computed.- Returns:
- either
SHORTESTorSTRAIGHTEST. - See Also:
setMethod(int)- Version:
- 19.04.04, 1.10 (ep) Made public.
-
setShortestMode
public void setShortestMode(int flag)
If shortest geodesics are computed, you have several different choices which local minimum is computed.- Parameters:
flag-- See Also:
SHORTEST_DIJKSTRA,SHORTEST_EUCL_DIJKSTRA,SHORTEST_ELEMENT_TREE
-
getShortestMode
public int getShortestMode()
If shortest geodesics are computed, you have several different choices which local minimum is computed.
-
setAngle
public void setAngle(double angle)
-
getAngle
public double getAngle()
-
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)
-
isConnected
public static boolean isConnected(PiVector[] neighb, PiVector elementrun)
Checks whether the given element indices belong to an edge connected element run. Added for debugging purposes.- Parameters:
neighb- neighbourhood information of geometryelementrun- list of element indices- Returns:
- true if the given list of elements is connected wrt the neighbourhood information
- See Also:
PgElementSet.getNeighbours()- Version:
- 25.04.04, 1.00 created (ep)
-
getConnectingStrip
public 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.- Version:
- 09.03.04, 2.00 revised (ep) Made public., 25.08.00, 2.00 revised (ep) Completely new.
-
getShortestInStrip
public static PgPolygon[] getShortestInStrip(PgElementSet geom, PdBary start, PdBary end, int[] strip, PiVector outSide, PiVector outvertind, PdBaryDir initialDir)
Deprecated. since 06.05.04, usegetShortestInUnfoldedTriangleRun(...)instead.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 (excluding 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 vertexinitialDir- output: initial barycentric direction of shortest polygon in element strip[0]- Returns:
- list of 2-dim polygons:
[0]= left border of element strip or null if only one element in strip
[1]= right border of element strip or null if only one element in strip
[2]= shortest polygon. if only one element in strip then only the length is correct, the rest arbitrary.
returns null if an error occurred - Version:
- 03.08.00, 1.00 created (ep)
-
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. It is the locally shortest that is generated by contracting the curve in a given triangle run. The one that connects start and endpoint crossing the least number of triangles is used (shortest face dijkstra connection).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.
- Parameters:
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.- Returns:
- A shortest connection between starting and endpoint as a polygon on element set, or null if an error occured.
- See Also:
PgPolygonOnElementSet- Version:
- 08.08.00, 1.00 created (ep)
-
getShortest
public 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. That doesn't have to be THE shortest connection between the points. It is the locally shortest that is generated by contracting the curve in a given triangle run. If no triangle run is given, then the one that connects start and endpoint crossing the least number of triangles is used (shortest face Dijkstra connection).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.
- Parameters:
geom- The element set. Must have valid neighbourhood 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.- Returns:
- A (locally) shortest connection between starting and endpoint as a polygon on element set, or null if an error occured.
- See Also:
PgPolygonOnElementSet- Version:
- 09.03.04, 1.00 created from previous method (ep)
-
getShortest
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)
Computes a shortest geodesic that connects given points on a triangulation. That doesn't have to be THE shortest connection between the points. It is the locally shortest that is generated by contracting the curve in a given triangle run. If no triangle run is given, then the one that connects start and endpoint crossing the least number of triangles is used (shortest face Dijkstra connection).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.
- Parameters:
geom- The element set. Must have valid neighbourhood 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.- Returns:
- A (locally) shortest connection between starting and endpoint as a polygon on element set, or null if an error occured.
- See Also:
PgPolygonOnElementSet- Version:
- 06.05.04, 2.00 rewrite (ep) Complete rewrite for new 2d-getShortest method.
09.03.04, 1.00 created from previous method (ep)
-
unfoldTriangleRun
public 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. The same local indices are used for the vertices of the triangle. (geom.getElement(run.getEntry(i)).getEntry(k)is unfolded tounfolded.getElement(i).getEntry(k).)The generated geometry has no neighbourhood information or normals.
- Parameters:
geom- a triangulation withdimOfVertices >= 3; may not contain degenerate edgesrun- must havelength >= 1and 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 i-th 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 left- Returns:
- the modified triangle run or null if error occurred
- Version:
- 06.05.04, 1.00 created (ep)
-
getShortestInUnfoldedTriangleRun
public 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. Returned is a sequence of indices to the lists of the left and right boundary. UseunfoldTriangleRun(...)to get the data needed by this method from a higher dimensional surface.
Run must contain at least 2 triangles.
Algorithm is the one from Lee, Preparata; Euclidean Shortest Paths in the Presence of Rectilinear Barriers; Networks vol 14 (1984).- Parameters:
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 array- Returns:
- same instance as parameter 'output' or a new instance if 'output' is null.
- Version:
- 06.05.04, 1.00 created (ep)
-
getDijkstraDistance
public 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.- Parameters:
geom- The element set. Neighourhood information is not needed.front- Indices of vertices on the initial front.- Returns:
- Distance of each vertex to the given center vertex.
- Version:
- 15.02.02, 1.01 revised (ur) Slight bug removed in creating adjacent vertices list.
19.01.02, 1.00 created (kp)
-
removeLoops
public 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- Parameters:
source- inout (source with loops removed is put here)len- number of entries in source to be consideredtemp- should be oflength >= max_i(source[i])(no check performed)- Returns:
- length of relevant output entries in parameter 'source'
- Version:
- 21.04.04, 1.00 created (ep)
-
getEuclideanDijkstraDistance
public 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. The edge weight is the Euclidean length of the edge.- Returns:
- PdVector dist of each vertex to the initial vertices.
- Version:
- 16.02.04, 1.00 created (kh)
-
-
"