java.lang.Object
gov.nih.mipav.view.renderer.WildMagic.Render.Geodesic_WM

public class Geodesic_WM extends Object
Author:
Alexandra Bokinsky, Ph.D. Under contract from Magic Software.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private boolean[]
    List of triangles to remove.
    private int[]
    The indices of the triangle containing the end of the new line.
    private int[]
    The indices of the triangle containing the first point on the new line.
    private int[]
    vertices array.
    private int[]
    For shifting the triangle indices after removing triangles from the mesh.
    private int[]
    The indices of the triangle containing the previous start point.
    private int[]
    The indices of the triangle containing the start of the new line.
    private LinkedList<Integer>[]
    Data members used in Dijkstra's search.
    private boolean
    Turned on when picking with the mouse is enabled:.
    private boolean
    Flag to indicates end point changes.
    private boolean
    Closing the Geodesic path:.
    private boolean
     
    private boolean
    Flag for clearing the Geodesic curves, if it is false, no curves have been added to the GeodesicGroup.
    private boolean
    Live wire last point.
    private boolean
    Live wire or point and click mode.
    private boolean
    Close path or not.
    private boolean[]
    For Dijkstra search.
    private float
    Path length statistics for each type of path:.
    private float
    Radius of the sphere displayed to mark the points on the Geodesic.
    private float[]
    Weights, relaxed flags, and previous vertex index for Dijkstra's search:.
    private float
    Length of the smoothed geodesic path
    private float[]
    For Dijkstra search.
    private int
    The number of line segments on the Dijkstra curve.
    private int
    The index of the vertex in the triangle mesh where the Geodesic curve is to end.
    private int
    The number of line segments on the Euclidian curve.
    private int
    index count.
    private int
    The index of the last node on a closed path.
    private int
    Number of vertices in the geodesic curve.
    private int
    Number of meshes.
    private int
    Number of triangles not removed during a cut mesh operation.
    private int
    Keeps track of the of picking, so that when a pair of points has been picked the Geodesic is calculated:.
    private int
    Number of triangles removed during a cut mesh operation.
    private int
    Number of triangles in the mesh, after the new triangles are added:.
    private int
    number of vertices in the path.
    private int[]
    For Dijkstra search.
    private int
    Root group for different path.
    private int
    The start index value for the pair of points.
    private int
    Local copies of the Vertex and Index arrays: a local copy is kept so that when the start or end points fall inside a triangle, a new vertex is added to the vertex array, and three new triangles are added to the triangle index array, new normals are added to the Normal array:.
    Data member for Dijkstra's search.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    End point on the curve.
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Surface the End point is on.
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    The finished TriMesh
    private WildMagic.LibFoundation.Mathematics.Vector3f
    First point, for closing the Geodesic curve:.
    private LinkedList<LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f>>
    For finished paths, either open or closed:.
    private LinkedList<LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f>>
    LinkedLists to contain the working paths in progress, and all finished paths, open and closed for the smoothed geodesics and dijkstra's geodesics.
    LinkedLists to contain the working paths in progress, and all finished paths, open and closed for the smoothed geodesics and dijkstra's geodesics.
    LinkedLists to contain the working paths in progress, and all finished paths, open and closed for the smoothed geodesics and dijkstra's geodesics.
    private WildMagic.LibFoundation.Mathematics.Vector3f[]
    The final list of points in the Geodesic curve.
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Previous cut mesh
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Previous mesh with a finished curve
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Current modified mesh
    private LinkedList<WildMagic.LibFoundation.Mathematics.ColorRGBA>
    New Colors link list.
    private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>
    New normal link list.
    private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>
    New texCoords link list.
    private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>
    new triangle link list.
    private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>
    New vertices link list.
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Data members for the Geodesic Class: Triangle mesh:.
    (package private) JPanelGeodesic_WM
    Reference to the JPanelGeodesic:.
    private JProgressBar
    Volume renderer progress bar:.
    private WildMagic.LibFoundation.Mathematics.ColorRGB[]
    Color of the first and successive points on the Geodesic curve:.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    Previous start point on the new line segment.
    private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>
    Removed triangle link list.
    private LinkedList<LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>>
    link list to hold the path.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    Start and End points -- pair of points for which a Geodesic is calculated, must be in TriangleMesh coordinates:.
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    TriMesh containing the start point on the new line segment
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Current TriMesh surface
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    Backup surface.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiation without initializing the progress bar, pickCanvas, GeodesicGroup, triangle mesh or sphere radius, each of those can be set through individual member access functions:.
    Geodesic_WM(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, float fRadius)
    Instantiation of the Geodesic object, with the objects necessary for the Geodesic to serve as a MouseListener that performs picking and with the Group kGeodesicGroup so that the Geodesic curve can be drawn directly on the TriMesh.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    addEdge(int iEdgeIndex, int iNewEdge)
    Add the edge to the EdgeList, check to make sure that edge has not already been added.
    private int
    checkOnEdge(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kPoint, int[] aiTriIndex, WildMagic.LibFoundation.Mathematics.Vector3f kNormal, WildMagic.LibFoundation.Mathematics.Vector3f kTexCoord, WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
    Given a point which is known to be inside a triangle, and that triangle, this function determines which edge, if any, that point falls on.
    private void
    cleanUp deletes the data stuctures used for the Dijkstra's search, but does not delete the array of points on the Geodesic curve.
    void
    clear(boolean bAll)
    Clear all geodesics curves drawn on the surface.
    private void
    clears the all the points added in livewire mode when clear all is called from the user interface.
    void
    clearCut(boolean bAll)
    Clear the current geodesics curve drawn on the surface.
    private void
    clears the last points added in livewire mode when clear last point is called from the user interface.
    boolean
    computeGeodesic(float fPercentage, boolean bSmoothed)
    Compute the Geodesic curve.
    private boolean
    contains(LinkedList kTriList, WildMagic.LibFoundation.Mathematics.Vector3f kNewTri)
    Contains determines if the linked list kTriList contains the input triangle, which is specified by three vertex indices.
    private int
    containsVector(LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> kVecList, WildMagic.LibFoundation.Mathematics.Vector3f kNewTri)
    Return index of the Vector3f in the list.
    private boolean
    createEdgeLists(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
    Create the edges list from the given surface triangle mesh.
    private WildMagic.LibGraphics.SceneGraph.TriMesh
    createNewMesh(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iVertexCount, int iOldVertexCount)
    creates a new mesh after triangulation or when a mesh is cut along the geodesic.
    boolean
    createPath(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iStart, int iEnd)
    createPath starts with the results of Dijkstra's minimum path algorithm.
    void
    cut()
    Cut the m_kModified mesh.
    void
    Deletes all member variables, clean memory.
    private float
    distance(WildMagic.LibFoundation.Mathematics.Vector3f kPoint1, WildMagic.LibFoundation.Mathematics.Vector3f kPoint2)
    Calculate the Euclidean distance between two points.
    void
    drawDijkstraEuclidianPath(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, WildMagic.LibGraphics.SceneGraph.TriMesh kWorking, int iStart, int iEnd)
    drawPath draws the Dijkstra path and Euclidian paths and adds them to the corresponding m_kDijkstraGeodesicGroup and m_kEuclidianGeodesicGroups.
    private void
    drawDijkstraEuclidianPoint(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, WildMagic.LibFoundation.Mathematics.Vector3f kStart, WildMagic.LibFoundation.Mathematics.ColorRGB kColor)
    Draw the user-selected point as a sphere on the triangle mesh, the sphere is added to all three drawing groups: m_kSmoothedGeodesicGroup, m_kDijkstraGeodesicGroup, and m_kEuclidianGeodesicGroup.
    void
    drawGeodesicPath(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, int iStart, int iEnd)
    drawPath draws the Geodesic path as a LineArray and adds it to the children of the m_kSmoothedGeodesicGroup object, it also draws the Dijkstra path and Euclidian paths and adds them to the corresponding m_kDijkstraGeodesicGroup and m_kEuclidianGeodesicGroups.
    private void
    drawGeodesicPoint(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, WildMagic.LibFoundation.Mathematics.Vector3f kStart, WildMagic.LibFoundation.Mathematics.ColorRGB kColor)
    Draw the user-selected point as a sphere on the triangle mesh, the sphere is added to all three drawing groups: m_kSmoothedGeodesicGroup, m_kDijkstraGeodesicGroup, and m_kEuclidianGeodesicGroup.
    void
    drawPath(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iStart, int iEnd)
    drawPath draws the Geodesic path as a LineArray and adds it to the children of the m_kSmoothedGeodesicGroup object, it also draws the Dijkstra path and Euclidian paths and adds them to the corresponding m_kDijkstraGeodesicGroup and m_kEuclidianGeodesicGroups.
    private void
    drawPoint(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kStart, WildMagic.LibFoundation.Mathematics.ColorRGB kColor)
    Draw the user-selected point as a sphere on the triangle mesh, the sphere is added to all three drawing groups: m_kSmoothedGeodesicGroup, m_kDijkstraGeodesicGroup, and m_kEuclidianGeodesicGroup.
    private int
    Used in cutting closed paths and creating new meshes to export to the scene graph.
    private void
    findEdges(int iIndex, boolean[] bFound)
    Go through the edge list find the the edge specified.
    private float
    findMin(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kStart, int iMiddle, int iSide, WildMagic.LibFoundation.Mathematics.Vector3f kEnd, WildMagic.LibFoundation.Mathematics.Vector4f kNewPoint4)
    findMin finds the point (newpoint) along the edge that connects the points Side-Middle that minimizes the distance Start-newpoint-End.
    private int
    findNewMeshes(WildMagic.LibGraphics.SceneGraph.TriMesh kSourceMesh, LinkedList kGeodesic_Closed_Loops)
    Used in cutting closed paths and creating new meshes to export to the scene graph.
    private int
    The findSmallest function searches through the list of vertices that are not yet relaxed but that have been visited by the Dijkstra Search, so that the weight factor is not Float.MAX_VALUE, but also is not the minimum value for that node.
    private int
    findTriPoints(int iNode1, int iNode2, LinkedList<Integer> kEndPoints)
    Find the next side triangle index.
    void
    finish(boolean bOpen)
    Closes the geodesic curve.
    private void
    finishWorkingLists(boolean bOpen)
    Adds the working paths to the finished path lists, combining the segments in the working paths into one path.
    private WildMagic.LibFoundation.Mathematics.ColorRGBA
    getColor(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int[] aiIndex)
    Calculates and returns the start point color for a new starting point inside an existing triangle.
    private WildMagic.LibFoundation.Mathematics.ColorRGBA
    getColor(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iIndex1, int iIndex2)
    Get the the triangle color from the given triangle index.
    boolean
    Access on when picking with the mouse is enabled.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    getNormal(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int[] aiIndex)
    Calculates and returns the start point normal for a new starting point inside an existing triangle.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    getNormal(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iIndex1, int iIndex2)
    Get the the triangle normal from the given triangle index.
    int
    Returns the number of points in the geodesic curve.
    private int
    getPathIndex(LinkedList kPath, int iVertexCount, int iIndex, boolean bOpen)
    getPathIndex returns what the new vertex index should be.
    void
    getPathPoint(int iPoint, WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
    Access to the i-th point on the Geodesic curve.
    void
    getPathPoints(WildMagic.LibFoundation.Mathematics.Vector3f[] akPoints)
    Access to the all the points on the Geodesic curve.
    private void
    getStartEnd(int iWhich)
    In livewire mode the endpoints of each path segment along Dijkstra's curve -- between each of the user-selected points -- are stored so that the smoothed geodesic may be calculated and displayed later.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    getTexCoord(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int[] aiIndex)
    Calculates and returns the start point texture coordinate for a new starting point inside an existing triangle.
    private WildMagic.LibFoundation.Mathematics.Vector3f
    getTexCoord(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iIndex1, int iIndex2)
    Get the the triangle texture coordinate from the given triangle index.
    private void
    Initializes the colors for the first point on the curve, and the successive points.
    private void
    initializeGeodesic(float fPercentage)
    initializeGeodesic copies the triangle mesh and initializes the data structures for Dijkstra's Single-Source shortest path algorithm.
    private boolean
    onRight(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iPrevIndex, int iIndex, int iSideIndex)
    onRight determines if a given point on a triangle, kSide, is to the right of or to the left of the vector specified by the vertices kPrev - kPoint.
    private void
    outputDeletedAsNew(WildMagic.LibGraphics.SceneGraph.TriMesh kSourceMesh)
    creating new meshes to export to the scene graph.
    private void
    relaxEdges(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iNode)
    This function determines the shortest path from the start vertex through the input vertex to the vertices that neighbor the input vertex.
    private void
    Remove all the geodesic lines and reset to draw the new geodesic lines.
    private void
    In livewire mode the endpoints of each path segment along Dijkstra's curve -- between each of the user-selected points -- are stored so that the smoothed geodesic may be calculated and displayed later.
    void
    setEnable(boolean bEnable)
    Enables picking with the mouse and drawing the curve on the mesh.
    void
    setEndIndex(int iIndex)
    Set the index of the vertex in the triangle mesh where the Geodesic curve is to end.
    void
    setEndIndices(int[] iIndices)
    Sets the indices of the triangle that the end point is located in.
    void
    setEndPoint(WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
    Sets the end point of the geodesic curve on the mesh.
    private void
    setEndSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
    The start and end surfaces ensure that the points on the geodesic curve all fall on one mesh, and that the algorithm isn't trying to find a path between two unconnected meshes.
    void
    Access to the JPanelGeodesic interface object.
    void
    setPickedPoint(WildMagic.LibGraphics.Collision.PickRecord kPickPoint, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
     
    void
    setPreviousStartIndices(int[] iIndices)
    Sets the indices of the triangle that the previous start point is located in.
    private void
    setPreviousStartPoint(WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
    Sets the previous start point of the geodesic curve on the mesh.
    void
    setRadius(float fRadius)
    Set the radius of the spheres used to mark the start and end points on the geodesic curve.
    void
    setStartIndex(int iIndex)
    Set the index of the vertex in the triangle mesh where the Geodesic curve is to start.
    void
    setStartIndices(int[] iIndices, boolean bFirst)
    Sets the indices of the triangle that the start point is located in.
    void
    setStartPoint(WildMagic.LibFoundation.Mathematics.Vector3f kPoint, boolean bFirst)
    Sets the start point of the geodesic curve on the mesh.
    private void
    setStartSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
    The start and end surfaces ensure that the points on the geodesic curve all fall on one mesh, and that the algorithm isn't trying to find a path between two unconnected meshes.
    private void
    setSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
    Access function to set the triangle mesh that the geodesic curve is calculated on.
    private int
    smoothPath(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iNode, LinkedList<Integer> kLeft, LinkedList<Integer> kMiddle, LinkedList<Integer> kRight, LinkedList<Integer> kLeftTemp, LinkedList<Integer> kRightTemp, LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f> kNewVertTemp)
    Smooth the path.
    private void
    sortTriIndex(WildMagic.LibFoundation.Mathematics.Vector3f aiAddTri, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer)
    Used when new triangles are added to the mesh, either when the mesh is triangulated along the smoothed geodesic curve, or when the mesh is cut. sortTriIndex sorts the triangle indices so that the triangle is always front-facing and that the normals are correct for rendering
    void
    Toggle between livewire mode and point invalid input: '&' click mode.
    private int
    triangleEdge(int i0, int i1, int i2, int iP0, int iP1)
    if the two of the first three triangle indices equal the second two indices, then the third index is returned.
    private boolean
    triangleEquals(int i0, int i1, int i2, int iP0, int iP1, int iP2)
    Returns true if the first three triangle indices equal the second three indices.
    private boolean
    triangleExists(WildMagic.LibFoundation.Mathematics.Vector3f kTri)
    Check to see if the triangle specified in the triangle list.
    private int
    triangulate(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, LinkedList kPath, LinkedList kLeftPath, LinkedList kRightPath, int iVertexCount)
    triangulates the mesh along a single geodesic.
    private void
    re-triangulates the mesh along the Smoothed Geodesic.
    private int
    unZip(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f> kPath, int iVertexCount, boolean bOpen, LinkedList<Integer> kNewPath)
    unZip cuts along the smoothed geodesic path by creating new vertices for each point on the path, and updating the triangles that are connected to the path and that fall on the right of the path to contain the new path vertices.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • m_kPanel

      Reference to the JPanelGeodesic:.
    • m_abRemoveTris

      private boolean[] m_abRemoveTris
      List of triangles to remove.
    • m_aiEndIndex

      private int[] m_aiEndIndex
      The indices of the triangle containing the end of the new line.
    • m_aiFirstIndex

      private int[] m_aiFirstIndex
      The indices of the triangle containing the first point on the new line.
    • m_aiIndex

      private int[] m_aiIndex
      vertices array.
    • m_aiIndexShift

      private int[] m_aiIndexShift
      For shifting the triangle indices after removing triangles from the mesh.
    • m_aiPreviousStartIndex

      private int[] m_aiPreviousStartIndex
      The indices of the triangle containing the previous start point.
    • m_aiStartIndex

      private int[] m_aiStartIndex
      The indices of the triangle containing the start of the new line.
    • m_akEdgeList

      private LinkedList<Integer>[] m_akEdgeList
      Data members used in Dijkstra's search. The Edgelist is a list for each vertex of all the vertices that it is connected to by one edge. The vertices are stored in the Edgelist as the vertex index.
    • m_bEnabled

      private boolean m_bEnabled
      Turned on when picking with the mouse is enabled:.
    • m_bEndpointChanged

      private boolean m_bEndpointChanged
      Flag to indicates end point changes.
    • m_bFinished

      private boolean m_bFinished
      Closing the Geodesic path:.
    • m_bFirstWire

      private boolean m_bFirstWire
    • m_bGroupAdded

      private boolean m_bGroupAdded
      Flag for clearing the Geodesic curves, if it is false, no curves have been added to the GeodesicGroup.
    • m_bLastWire

      private boolean m_bLastWire
      Live wire last point.
    • m_bLivewire

      private boolean m_bLivewire
      Live wire or point and click mode.
    • m_bOpen

      private boolean m_bOpen
      Close path or not.
    • m_bRelaxed

      private boolean[] m_bRelaxed
      For Dijkstra search.
    • m_fDijkstraPathLength

      private float m_fDijkstraPathLength
      Path length statistics for each type of path:.
    • m_fRadius

      private float m_fRadius
      Radius of the sphere displayed to mark the points on the Geodesic. This can be set directly by the class using the Geodesic object.
    • m_fRemainingWeight

      private float[] m_fRemainingWeight
      Weights, relaxed flags, and previous vertex index for Dijkstra's search:.
    • m_fSmoothedPathLength

      private float m_fSmoothedPathLength
      Length of the smoothed geodesic path
    • m_fWeight

      private float[] m_fWeight
      For Dijkstra search.
    • m_iEnd

      private int m_iEnd
      The index of the vertex in the triangle mesh where the Geodesic curve is to end.
    • m_iIndexCount

      private int m_iIndexCount
      index count.
    • m_iLineClosed

      private int m_iLineClosed
      The index of the last node on a closed path.
    • m_iNumGeodesicVertices

      private int m_iNumGeodesicVertices
      Number of vertices in the geodesic curve.
    • m_iNumNewMeshes

      private int m_iNumNewMeshes
      Number of meshes.
    • m_iNumPicked

      private int m_iNumPicked
      Keeps track of the of picking, so that when a pair of points has been picked the Geodesic is calculated:.
    • m_iNumTriangles

      private int m_iNumTriangles
      Number of triangles in the mesh, after the new triangles are added:.
    • m_iNumWorking

      private int m_iNumWorking
      number of vertices in the path.
    • m_iPrevious

      private int[] m_iPrevious
      For Dijkstra search.
    • m_iStart

      private int m_iStart
      The start index value for the pair of points.
    • m_iVertexCount

      private int m_iVertexCount
      Local copies of the Vertex and Index arrays: a local copy is kept so that when the start or end points fall inside a triangle, a new vertex is added to the vertex array, and three new triangles are added to the triangle index array, new normals are added to the Normal array:.
    • m_kBorder

      private LinkedList<Integer> m_kBorder
      Data member for Dijkstra's search. The m_kBorder list stores all the vertices that have been visited by Dijkstra's search, but that have not yet been relaxed. It is used to speed up the search for the non-relaxed vertex with the smallest path distance
    • m_iDijkstraGeodesicGroup

      private int m_iDijkstraGeodesicGroup
      The number of line segments on the Dijkstra curve.
    • m_kEndPoint

      private WildMagic.LibFoundation.Mathematics.Vector3f m_kEndPoint
      End point on the curve.
    • m_kEndSurface

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kEndSurface
      Surface the End point is on.
    • m_iEuclidianGeodesicGroup

      private int m_iEuclidianGeodesicGroup
      The number of line segments on the Euclidian curve.
    • m_kFinished

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kFinished
      The finished TriMesh
    • m_kFirstPoint

      private WildMagic.LibFoundation.Mathematics.Vector3f m_kFirstPoint
      First point, for closing the Geodesic curve:.
    • m_kGeodesic_Finished

      private LinkedList<LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f>> m_kGeodesic_Finished
      For finished paths, either open or closed:.
    • m_kGeodesic_Working

      private LinkedList<LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f>> m_kGeodesic_Working
      LinkedLists to contain the working paths in progress, and all finished paths, open and closed for the smoothed geodesics and dijkstra's geodesics. These are used in the cutting operations: For paths that are not finished, points may still be added to these paths:
    • m_kGeodesic_Working_Left

      private LinkedList<LinkedList<Integer>> m_kGeodesic_Working_Left
      LinkedLists to contain the working paths in progress, and all finished paths, open and closed for the smoothed geodesics and dijkstra's geodesics. These are used in the cutting operations: For paths that are not finished, points may still be added to these paths:
    • m_kGeodesic_Working_Right

      private LinkedList<LinkedList<Integer>> m_kGeodesic_Working_Right
      LinkedLists to contain the working paths in progress, and all finished paths, open and closed for the smoothed geodesics and dijkstra's geodesics. These are used in the cutting operations: For paths that are not finished, points may still be added to these paths:
    • m_kGeodesicVertices

      private WildMagic.LibFoundation.Mathematics.Vector3f[] m_kGeodesicVertices
      The final list of points in the Geodesic curve. All points are constrained to lie on the triangle mesh,
    • m_kLastCut

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kLastCut
      Previous cut mesh
    • m_kLastFinished

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kLastFinished
      Previous mesh with a finished curve
    • m_kModified

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kModified
      Current modified mesh
    • m_kNewNormals

      private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> m_kNewNormals
      New normal link list.
    • m_kNewTexCoords

      private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> m_kNewTexCoords
      New texCoords link list.
    • m_kNewColors

      private LinkedList<WildMagic.LibFoundation.Mathematics.ColorRGBA> m_kNewColors
      New Colors link list.
    • m_kNewTriangles

      private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> m_kNewTriangles
      new triangle link list.
    • m_kNewVerts

      private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> m_kNewVerts
      New vertices link list.
    • m_kOriginal

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kOriginal
      Data members for the Geodesic Class: Triangle mesh:.
    • m_kPBar

      private JProgressBar m_kPBar
      Volume renderer progress bar:.
    • m_kPickColors

      private WildMagic.LibFoundation.Mathematics.ColorRGB[] m_kPickColors
      Color of the first and successive points on the Geodesic curve:.
    • m_kPreviousStartPoint

      private WildMagic.LibFoundation.Mathematics.Vector3f m_kPreviousStartPoint
      Previous start point on the new line segment.
    • m_kRemoveTriangles

      private LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> m_kRemoveTriangles
      Removed triangle link list.
    • m_iSmoothedGeodesicGroup

      private int m_iSmoothedGeodesicGroup
      Root group for different path.
    • m_kStartEndList

      private LinkedList<LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f>> m_kStartEndList
      link list to hold the path.
    • m_kStartPoint

      private WildMagic.LibFoundation.Mathematics.Vector3f m_kStartPoint
      Start and End points -- pair of points for which a Geodesic is calculated, must be in TriangleMesh coordinates:.
    • m_kStartSurface

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kStartSurface
      TriMesh containing the start point on the new line segment
    • m_kSurface

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kSurface
      Current TriMesh surface
    • m_kSurfaceBackup

      private WildMagic.LibGraphics.SceneGraph.TriMesh m_kSurfaceBackup
      Backup surface.
    • m_iNumRemoved

      private int m_iNumRemoved
      Number of triangles removed during a cut mesh operation.
    • m_iNumNotRemoved

      private int m_iNumNotRemoved
      Number of triangles not removed during a cut mesh operation.
  • Constructor Details

    • Geodesic_WM

      public Geodesic_WM()
      Instantiation without initializing the progress bar, pickCanvas, GeodesicGroup, triangle mesh or sphere radius, each of those can be set through individual member access functions:.
    • Geodesic_WM

      public Geodesic_WM(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, float fRadius)
      Instantiation of the Geodesic object, with the objects necessary for the Geodesic to serve as a MouseListener that performs picking and with the Group kGeodesicGroup so that the Geodesic curve can be drawn directly on the TriMesh.
      Parameters:
      kMesh - TriMesh surface
      fRadius - float marker sphere radius
      kPickCanvas - PickCanvas
      kGeodesicGroup - Group
  • Method Details

    • clear

      public void clear(boolean bAll)
      Clear all geodesics curves drawn on the surface.
      Parameters:
      bAll - bAll, when true clears all the geodesic curves, when false, clears the last point drawn:
    • clearCut

      public void clearCut(boolean bAll)
      Clear the current geodesics curve drawn on the surface.
      Parameters:
      bAll - bAll, when true clears all the geodesic curves, when false, clears the last point drawn:
    • computeGeodesic

      public boolean computeGeodesic(float fPercentage, boolean bSmoothed)
      Compute the Geodesic curve. The triangle mesh, start, and end points, start and end indices must be defined before this function is called.
      Parameters:
      fPercentage - float, the optimization parameter for Dijkstra's shortest-path search. Values between 0-100, (increasing optimization).
      bSmoothed - flag to smoothes and stores the shortest path.
      Returns:
      true on successful path creation.
    • createPath

      public boolean createPath(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iStart, int iEnd)
      createPath starts with the results of Dijkstra's minimum path algorithm. It smooths the path, and stores the resulting points in the m_kGeodesicPath data member.
      Parameters:
      iStart - int given geodesic line starting point
      iEnd - int given geodesic line ending point
      Returns:
      boolean success or not
    • cut

      public void cut()
      Cut the m_kModified mesh.
    • dispose

      public void dispose()
      Deletes all member variables, clean memory.
    • drawDijkstraEuclidianPath

      public void drawDijkstraEuclidianPath(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, WildMagic.LibGraphics.SceneGraph.TriMesh kWorking, int iStart, int iEnd)
      drawPath draws the Dijkstra path and Euclidian paths and adds them to the corresponding m_kDijkstraGeodesicGroup and m_kEuclidianGeodesicGroups.
      Parameters:
      iStart - int Dijkstra path starting point
      iEnd - int Dijkstra path ending point
    • drawGeodesicPath

      public void drawGeodesicPath(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, int iStart, int iEnd)
      drawPath draws the Geodesic path as a LineArray and adds it to the children of the m_kSmoothedGeodesicGroup object, it also draws the Dijkstra path and Euclidian paths and adds them to the corresponding m_kDijkstraGeodesicGroup and m_kEuclidianGeodesicGroups.
      Parameters:
      iStart - int Geodesic path starting point
      iEnd - int Geodesic path ending point
    • drawPath

      public void drawPath(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iStart, int iEnd)
      drawPath draws the Geodesic path as a LineArray and adds it to the children of the m_kSmoothedGeodesicGroup object, it also draws the Dijkstra path and Euclidian paths and adds them to the corresponding m_kDijkstraGeodesicGroup and m_kEuclidianGeodesicGroups.
      Parameters:
      iStart - int Geodesic path starting point
      iEnd - int Geodesic path ending point
    • finish

      public void finish(boolean bOpen)
      Closes the geodesic curve.
      Parameters:
      bOpen - bOpen: when true leaves the geodesic open, when false closes the geodesic by connecting to the first point on the polyline sequence.
    • getEnable

      public boolean getEnable()
      Access on when picking with the mouse is enabled.
      Returns:
      boolean picking is enabled or not.
    • getNumPathPoints

      public int getNumPathPoints()
      Returns the number of points in the geodesic curve.
      Returns:
      int, the number of points on the Geodesic.
    • getPathPoint

      public void getPathPoint(int iPoint, WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
      Access to the i-th point on the Geodesic curve. All points on the geodesic curve lie on the triangle mesh.
      Parameters:
      iPoint - i-th point index
      kPoint - Vector3f point's coordinate
    • getPathPoints

      public void getPathPoints(WildMagic.LibFoundation.Mathematics.Vector3f[] akPoints)
      Access to the all the points on the Geodesic curve. All points on the geodesic curve lie on the triangle mesh.
      Parameters:
      akPoints - Vector3f[] points coordinates array
    • setEnable

      public void setEnable(boolean bEnable)
      Enables picking with the mouse and drawing the curve on the mesh.
      Parameters:
      bEnable - set the mouse picking enabled or not.
    • setEndIndex

      public void setEndIndex(int iIndex)
      Set the index of the vertex in the triangle mesh where the Geodesic curve is to end. The index must be less than or equal to the number of vertices in the triangle mesh.
      Parameters:
      iIndex - int the index of the vertex in the triangle mesh where the Geodesic curve is to end.
    • setEndIndices

      public void setEndIndices(int[] iIndices)
      Sets the indices of the triangle that the end point is located in. This is used when the end point falls on the inside of a triangle in the mesh, the indices parameter defines which triangle the end point falls in.
      Parameters:
      iIndices - int[3] array of vertex indices defining the end triangle.
    • setEndPoint

      public void setEndPoint(WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
      Sets the end point of the geodesic curve on the mesh. The point coordinates must be in local mesh coordinates.
      Parameters:
      kPoint - the point on the triangle mesh where the geodesic curve is to end, in mesh coordinates.
    • setPanel

      public void setPanel(JPanelGeodesic_WM kPanel)
      Access to the JPanelGeodesic interface object.
      Parameters:
      kPanel - JPanelGeodesic geodesic panel
    • setPickedPoint

      public void setPickedPoint(WildMagic.LibGraphics.Collision.PickRecord kPickPoint, WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
    • setPreviousStartIndices

      public void setPreviousStartIndices(int[] iIndices)
      Sets the indices of the triangle that the previous start point is located in. This is used when the start point falls on the inside of a triangle in the mesh, the indices parameter defines which triangle the start point falls in.
      Parameters:
      iIndices - index coordinate
    • setRadius

      public void setRadius(float fRadius)
      Set the radius of the spheres used to mark the start and end points on the geodesic curve.
      Parameters:
      fRadius - the size of the marker sphere to be drawn on the mesh
    • setStartIndex

      public void setStartIndex(int iIndex)
      Set the index of the vertex in the triangle mesh where the Geodesic curve is to start. The index must be less than or equal to the number of vertices in the triangle mesh.
      Parameters:
      iIndex - int the index of the vertex in the triangle mesh where the Geodesic curve is to start.
    • setStartIndices

      public void setStartIndices(int[] iIndices, boolean bFirst)
      Sets the indices of the triangle that the start point is located in. This is used when the start point falls on the inside of a triangle in the mesh, the indices parameter defines which triangle the start point falls in.
      Parameters:
      iIndices - int[3] array of vertex indices defining the start triangle.
      bFirst - flag indicate the first indices defining the start triangle.
    • setStartPoint

      public void setStartPoint(WildMagic.LibFoundation.Mathematics.Vector3f kPoint, boolean bFirst)
      Sets the start point of the geodesic curve on the mesh. The point coordinates must be in local mesh coordinates.
      Parameters:
      kPoint - the point on the triangle mesh where the geodesic curve is to start, in mesh coordinates.
      bFirst - flag indicate the first indices defining the start triangle.
    • toggleLivewire

      public void toggleLivewire()
      Toggle between livewire mode and point invalid input: '&' click mode.
    • addEdge

      private void addEdge(int iEdgeIndex, int iNewEdge)
      Add the edge to the EdgeList, check to make sure that edge has not already been added.
      Parameters:
      iEdgeIndex - edge index
      iNewEdge - int added edge index
    • checkOnEdge

      private int checkOnEdge(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kPoint, int[] aiTriIndex, WildMagic.LibFoundation.Mathematics.Vector3f kNormal, WildMagic.LibFoundation.Mathematics.Vector3f kTexCoord, WildMagic.LibFoundation.Mathematics.ColorRGBA kColor)
      Given a point which is known to be inside a triangle, and that triangle, this function determines which edge, if any, that point falls on.
      Parameters:
      kMesh - TriMesh surface
      kPoint - Vector3f
      aiTriIndex - int[]
      kNormal - Vector3f
      Returns:
      int
    • cleanUp

      private void cleanUp()
      cleanUp deletes the data stuctures used for the Dijkstra's search, but does not delete the array of points on the Geodesic curve.
    • clearAllStartEnd

      private void clearAllStartEnd()
      clears the all the points added in livewire mode when clear all is called from the user interface.
    • clearLastStartEnd

      private void clearLastStartEnd()
      clears the last points added in livewire mode when clear last point is called from the user interface.
    • contains

      private boolean contains(LinkedList kTriList, WildMagic.LibFoundation.Mathematics.Vector3f kNewTri)
      Contains determines if the linked list kTriList contains the input triangle, which is specified by three vertex indices. The LinkedList member function contains is not used because the indices may be in a different order, and the function must return true if any of the triangles in the list match the input triangle regardless of the order the vertices are specified
      Parameters:
      kTriList - Link List
      kNewTri - Point3i input triangle vertex indices
      Returns:
      boolean contains the triangle or not.
    • containsVector

      private int containsVector(LinkedList<WildMagic.LibFoundation.Mathematics.Vector3f> kVecList, WildMagic.LibFoundation.Mathematics.Vector3f kNewTri)
      Return index of the Vector3f in the list.
      Parameters:
      kVecList - list of Vector3f
      kNewTri - Vector3f
      Returns:
      index of the Vector in the list, -1 if it is not in the list.
    • createEdgeLists

      private boolean createEdgeLists(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
      Create the edges list from the given surface triangle mesh.
      Parameters:
      kMesh - surface
      Returns:
      boolean success or not
    • createNewMesh

      private WildMagic.LibGraphics.SceneGraph.TriMesh createNewMesh(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iVertexCount, int iOldVertexCount)
      creates a new mesh after triangulation or when a mesh is cut along the geodesic.
      Parameters:
      kMesh - TriMesh surface
      iVertexCount - int new vertex count
      iOldVertexCount - int old vertex cunt
      Returns:
      TriMesh surface
    • distance

      private float distance(WildMagic.LibFoundation.Mathematics.Vector3f kPoint1, WildMagic.LibFoundation.Mathematics.Vector3f kPoint2)
      Calculate the Euclidean distance between two points.
      Parameters:
      kPoint1 - Point3f starting point
      kPoint2 - Point3f ending point
      Returns:
      float distance
    • drawDijkstraEuclidianPoint

      private void drawDijkstraEuclidianPoint(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, WildMagic.LibFoundation.Mathematics.Vector3f kStart, WildMagic.LibFoundation.Mathematics.ColorRGB kColor)
      Draw the user-selected point as a sphere on the triangle mesh, the sphere is added to all three drawing groups: m_kSmoothedGeodesicGroup, m_kDijkstraGeodesicGroup, and m_kEuclidianGeodesicGroup.
      Parameters:
      kStart - Point3f starting point
      kColor - Color3f ending point
    • drawGeodesicPoint

      private void drawGeodesicPoint(WildMagic.LibGraphics.SceneGraph.TriMesh kParent, WildMagic.LibFoundation.Mathematics.Vector3f kStart, WildMagic.LibFoundation.Mathematics.ColorRGB kColor)
      Draw the user-selected point as a sphere on the triangle mesh, the sphere is added to all three drawing groups: m_kSmoothedGeodesicGroup, m_kDijkstraGeodesicGroup, and m_kEuclidianGeodesicGroup.
      Parameters:
      kStart - Point3f starting point
      kColor - Color3f ending point
    • drawPoint

      private void drawPoint(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kStart, WildMagic.LibFoundation.Mathematics.ColorRGB kColor)
      Draw the user-selected point as a sphere on the triangle mesh, the sphere is added to all three drawing groups: m_kSmoothedGeodesicGroup, m_kDijkstraGeodesicGroup, and m_kEuclidianGeodesicGroup.
      Parameters:
      kStart - Point3f point coordinate
      kColor - Color3f point color
    • extractNewMesh

      private int extractNewMesh(LinkedList kLoop)
      Used in cutting closed paths and creating new meshes to export to the scene graph.
      Parameters:
      kLoop - LinkedList surface mesh link list
      Returns:
      int number of deleted vertices
    • findEdges

      private void findEdges(int iIndex, boolean[] bFound)
      Go through the edge list find the the edge specified.
      Parameters:
      iIndex - int edge index
      bFound - boolean[] edge being found
    • findMin

      private float findMin(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, WildMagic.LibFoundation.Mathematics.Vector3f kStart, int iMiddle, int iSide, WildMagic.LibFoundation.Mathematics.Vector3f kEnd, WildMagic.LibFoundation.Mathematics.Vector4f kNewPoint4)
      findMin finds the point (newpoint) along the edge that connects the points Side-Middle that minimizes the distance Start-newpoint-End.
      Parameters:
      kStart - Point3f starting point
      iMiddle - int middle point
      iSide - int side point index
      kEnd - Point3f end index
      kNewPoint4 - Point4f new point
      Returns:
      float find min point index
    • findNewMeshes

      private int findNewMeshes(WildMagic.LibGraphics.SceneGraph.TriMesh kSourceMesh, LinkedList kGeodesic_Closed_Loops)
      Used in cutting closed paths and creating new meshes to export to the scene graph.
      Parameters:
      kSourceMesh - TriMesh surface mesh
      kGeodesic_Closed_Loops - LinkedList closed path
      Returns:
      int
    • findSmallest

      private int findSmallest()
      The findSmallest function searches through the list of vertices that are not yet relaxed but that have been visited by the Dijkstra Search, so that the weight factor is not Float.MAX_VALUE, but also is not the minimum value for that node. In Dijkstra's search the vertex with the smallest weight is relaxed first, a greedy algorithm that chooses the locally closest vertex to add to the path. The final weight for the vertex is determined when it is relaxed.

      This function uses the data member m_kBorder -- the linked list of vertices that have been visited by Dijkstra's search, but which have not yet been relaxed.

      Returns:
      int index of the vertex with the smallest weight
    • findTriPoints

      private int findTriPoints(int iNode1, int iNode2, LinkedList<Integer> kEndPoints)
      Find the next side triangle index.
      Parameters:
      iNode1 - int node 1 along the side
      iNode2 - int node 2 along the side
      kEndPoints - end point Link List
      Returns:
      int next side triangle index
    • finishWorkingLists

      private void finishWorkingLists(boolean bOpen)
      Adds the working paths to the finished path lists, combining the segments in the working paths into one path.
      Parameters:
      bOpen - boolean close path or not
    • getColor

      private WildMagic.LibFoundation.Mathematics.ColorRGBA getColor(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iIndex1, int iIndex2)
      Get the the triangle color from the given triangle index.
      Parameters:
      kMesh - TriMesh surface mesh
      iIndex1 - int triangle point index 1
      iIndex2 - int triangle point index 2
      Returns:
      interpolated color the triangle
    • getColor

      private WildMagic.LibFoundation.Mathematics.ColorRGBA getColor(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int[] aiIndex)
      Calculates and returns the start point color for a new starting point inside an existing triangle. The new color is the average of the colors at each point in the triangle the starting point is inside
      Parameters:
      kMesh - TriMesh surface mesh
      aiIndex - int[] 3 triangle points
      Returns:
      Color4f Average color of the triangle.
    • getNormal

      private WildMagic.LibFoundation.Mathematics.Vector3f getNormal(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iIndex1, int iIndex2)
      Get the the triangle normal from the given triangle index.
      Parameters:
      kMesh - TriMesh surface mesh
      iIndex1 - int triangle point index 1
      iIndex2 - int triangle point index 2
      Returns:
      Vector3f normal of the triangle
    • getNormal

      private WildMagic.LibFoundation.Mathematics.Vector3f getNormal(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int[] aiIndex)
      Calculates and returns the start point normal for a new starting point inside an existing triangle. The new normal is the average of the normals at each point in the triangle the starting point is inside
      Parameters:
      kMesh - TriMesh surface mesh
      aiIndex - int[] 3 triangle points
      Returns:
      Vector3f Average normal of the triangle.
    • getPathIndex

      private int getPathIndex(LinkedList kPath, int iVertexCount, int iIndex, boolean bOpen)
      getPathIndex returns what the new vertex index should be. If the input index, iIndex, does fall on the cut path, kPath, then that point on the path is going to be duplicated to disconnect the triangles on either side of the cut path. Therefore the input index needs to be translated into a new vertex index, based on the current iVertexCount, the point's position along the path, and wehter or not the path is open or closed.
      Parameters:
      kPath - LinkedList path link list
      iVertexCount - int vertex count
      iIndex - int path index
      bOpen - boolean close path or not
      Returns:
      int the new vertex index
    • getStartEnd

      private void getStartEnd(int iWhich)
      In livewire mode the endpoints of each path segment along Dijkstra's curve -- between each of the user-selected points -- are stored so that the smoothed geodesic may be calculated and displayed later. This function retrieves the stored values when the livewire path is finished
      Parameters:
      iWhich - int path index
    • getTexCoord

      private WildMagic.LibFoundation.Mathematics.Vector3f getTexCoord(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iIndex1, int iIndex2)
      Get the the triangle texture coordinate from the given triangle index.
      Parameters:
      kMesh - TriMesh surface mesh
      iIndex1 - int triangle point index 1
      iIndex2 - int triangle point index 2
      Returns:
      interpolated texture coordinate the triangle
    • getTexCoord

      private WildMagic.LibFoundation.Mathematics.Vector3f getTexCoord(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int[] aiIndex)
      Calculates and returns the start point texture coordinate for a new starting point inside an existing triangle. The new texture coordinate is the average of the texture coordinates at each point in the triangle the starting point is inside
      Parameters:
      kMesh - TriMesh surface mesh
      aiIndex - int[] 3 triangle points
      Returns:
      Texture3f Average texture coordinate of the triangle.
    • initColors

      private void initColors()
      Initializes the colors for the first point on the curve, and the successive points.
    • initializeGeodesic

      private void initializeGeodesic(float fPercentage)
      initializeGeodesic copies the triangle mesh and initializes the data structures for Dijkstra's Single-Source shortest path algorithm.

      If the start and end vertices do not fall on a triangle vertex, then the triangle they fall inside split into three new triangles, by connecting the new vertex to each of the triangle vertices.

      Parameters:
      fPercentage - float the optimization parameter for Dijkstra's shortest-path search
    • onRight

      private boolean onRight(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iPrevIndex, int iIndex, int iSideIndex)
      onRight determines if a given point on a triangle, kSide, is to the right of or to the left of the vector specified by the vertices kPrev - kPoint.
      Parameters:
      kMesh - TriMesh surface mesh
      iPrevIndex - int previous vertice
      iIndex - int specified vertice index
      iSideIndex - int side vertice index
      Returns:
      boolean a point on the right or triangle or not.
    • outputDeletedAsNew

      private void outputDeletedAsNew(WildMagic.LibGraphics.SceneGraph.TriMesh kSourceMesh)
      creating new meshes to export to the scene graph.
    • relaxEdges

      private void relaxEdges(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iNode)
      This function determines the shortest path from the start vertex through the input vertex to the vertices that neighbor the input vertex.

      The function relaxEdges looks at all the vertices connected by triangle edges to the input vertex and calculated the weight factors for each of those vertices, adding those vertices that are not yet "relaxed" to the list of vertices on the border.

      Once the weight factors for each of the vertices connected to the input vertex are set, the input vertex is labeled "relaxed" and removed from the list of vertices on the border.

      Parameters:
      iNode - int input vertex index
    • resetDrawGeodesic

      private void resetDrawGeodesic()
      Remove all the geodesic lines and reset to draw the new geodesic lines.
    • saveStartEnd

      private void saveStartEnd()
      In livewire mode the endpoints of each path segment along Dijkstra's curve -- between each of the user-selected points -- are stored so that the smoothed geodesic may be calculated and displayed later.
    • setEndSurface

      private void setEndSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
      The start and end surfaces ensure that the points on the geodesic curve all fall on one mesh, and that the algorithm isn't trying to find a path between two unconnected meshes.
      Parameters:
      kMesh - TriMesh surface mesh
    • setPreviousStartPoint

      private void setPreviousStartPoint(WildMagic.LibFoundation.Mathematics.Vector3f kPoint)
      Sets the previous start point of the geodesic curve on the mesh. Used when the last point is deleted, the start point reverts to the previous start point. The point coordinates must be in local mesh coordinates.
      Parameters:
      kPoint - the point on the triangle mesh where the geodesic curve is to start, in mesh coordinates.
    • setStartSurface

      private void setStartSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
      The start and end surfaces ensure that the points on the geodesic curve all fall on one mesh, and that the algorithm isn't trying to find a path between two unconnected meshes.
      Parameters:
      kMesh - surface mesh
    • setSurface

      private void setSurface(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh)
      Access function to set the triangle mesh that the geodesic curve is calculated on.
      Parameters:
      kMesh - the new triangle mesh
    • smoothPath

      private int smoothPath(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, int iNode, LinkedList<Integer> kLeft, LinkedList<Integer> kMiddle, LinkedList<Integer> kRight, LinkedList<Integer> kLeftTemp, LinkedList<Integer> kRightTemp, LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f> kNewVertTemp)
      Smooth the path.
      Parameters:
      iNode - int vertex index
      kLeft - LinkedList left point
      kMiddle - LinkedList middle point
      kRight - LinkedList right point
      kLeftTemp - LinkedList left point temporary
      kRightTemp - LinkedList right point temporary
      kNewVertTemp - LinkedList new point temporary
      Returns:
      int success or not
    • sortTriIndex

      private void sortTriIndex(WildMagic.LibFoundation.Mathematics.Vector3f aiAddTri, WildMagic.LibGraphics.SceneGraph.VertexBuffer kVBuffer)
      Used when new triangles are added to the mesh, either when the mesh is triangulated along the smoothed geodesic curve, or when the mesh is cut. sortTriIndex sorts the triangle indices so that the triangle is always front-facing and that the normals are correct for rendering
      Parameters:
      aiAddTri - Point3i added triangle vertices
    • triangleEdge

      private int triangleEdge(int i0, int i1, int i2, int iP0, int iP1)
      if the two of the first three triangle indices equal the second two indices, then the third index is returned.
      Parameters:
      i0 - int first triangle indice 1
      i1 - int first triangle indice 2
      i2 - int first triangle indice 3
      iP0 - int second triangle indice 1
      iP1 - int second triangle indice 2
      Returns:
      int third index
    • triangleEquals

      private boolean triangleEquals(int i0, int i1, int i2, int iP0, int iP1, int iP2)
      Returns true if the first three triangle indices equal the second three indices.
      Parameters:
      i0 - first triangle indice 0
      i1 - first triangle indice 1
      i2 - first triangle indice 2
      iP0 - second triangle indice 0
      iP1 - second triangle indice 1
      iP2 - second triangle indice 2
      Returns:
      boolean true equal, false not
    • triangleExists

      private boolean triangleExists(WildMagic.LibFoundation.Mathematics.Vector3f kTri)
      Check to see if the triangle specified in the triangle list.
      Parameters:
      kTri - Point3i triangle specified
      Returns:
      boolean true in the list, false not in the list
    • triangulate

      private int triangulate(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, LinkedList kPath, LinkedList kLeftPath, LinkedList kRightPath, int iVertexCount)
      triangulates the mesh along a single geodesic.
      Parameters:
      kMesh - TriMesh surface mesh
      kPath - LinkedList path link list
      kLeftPath - LinkedList left path link list
      kRightPath - LinkedList right path link list
      iVertexCount - int vertex count
      Returns:
      int number of vertices
    • triangulateMeshPath

      private void triangulateMeshPath()
      re-triangulates the mesh along the Smoothed Geodesic.
    • unZip

      private int unZip(WildMagic.LibGraphics.SceneGraph.TriMesh kMesh, LinkedList<WildMagic.LibFoundation.Mathematics.Vector4f> kPath, int iVertexCount, boolean bOpen, LinkedList<Integer> kNewPath)
      unZip cuts along the smoothed geodesic path by creating new vertices for each point on the path, and updating the triangles that are connected to the path and that fall on the right of the path to contain the new path vertices. This cuts the mesh by disconnecting the triangles that are on the left and right sides of the geodesic path.
      Parameters:
      kMesh - TriMesh surface mesh
      kPath - LinkedList path link list
      iVertexCount - int vertex count
      bOpen - boolean closed path or not
      kNewPath - LinkedList new path link list
      Returns:
      int new number of vertices