Class ModelTriangleMeshCurveSegments


  • public class ModelTriangleMeshCurveSegments
    extends java.lang.Object
    DOCUMENT ME!
    • Field Detail

      • fDISTANCE_SCALE_FACTOR

        public static final float fDISTANCE_SCALE_FACTOR
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • m_aaaiConnectivity

        private int[][][] m_aaaiConnectivity
        The array of indexed triangle array coordinate indices. One per curve segment.
      • m_aafBreakPoints

        private float[][] m_aafBreakPoints
        The aray of points (defined in time) where the curvature of the spline is highest.
      • m_aafMaxDist

        private float[][] m_aafMaxDist
        Approximate "width" of the tube at the sample points on each curve.
      • m_aafRelativeLengths

        private float[][] m_aafRelativeLengths
        Values that are used in multiple functions, are stored so that they are calculated only once. Relative position on the curve
      • m_aaiNumTris

        private int[][] m_aaiNumTris
        The number of triangles in each sub-mesh.
      • m_aakCurvePos

        private javax.vecmath.Point3f[][] m_aakCurvePos
        Positions on the sample curve.
      • m_aakTangent

        private javax.vecmath.Vector3f[][] m_aakTangent
        Tangent vectors for each position on the sample curve.
      • m_aiNumBreakPoints

        private int[] m_aiNumBreakPoints
        The number of break points on the spline.
      • m_akCurvePosition

        private WildMagic.LibFoundation.Curves.Curve3f[] m_akCurvePosition
        The array of possible curves to use for segmenting the mesh.
      • m_iNumCurves

        private int m_iNumCurves
        The number of curves.
      • m_kMesh

        private ModelTriangleMesh m_kMesh
        The input triangle mesh to be segmented.
    • Constructor Detail

      • ModelTriangleMeshCurveSegments

        public ModelTriangleMeshCurveSegments​(ModelTriangleMesh kMesh,
                                              FlyPathGraphSamples kGraphSamples,
                                              FlyPathGraphCurve kGraphCurve,
                                              int iPathSamplesReductionFactor)
        Creates a new ModelTriangleMeshCurveSegments object.
        Parameters:
        kMesh - ModelTriangleMesh
        kGraphSamples - FlyPathGraphSamples
        kGraphCurve - FlyPathGraphCurve
        iPathSamplesReductionFactor - int

        The ModelTriangleMeshCurveSegments constructor takes a ModelTriangleMesh, a list of Curves, and the point samples for those curves and produces a collection of sub-meshes smaller than the original mesh. The sub-meshes are constructed such that when the viewpoint is inside one of the sub-meshes only the triangles in that sum-mesh are visible. Allowing the program to send a smaller number of triangles through the graphics piplines will increase performance for large triangle meshes.

        The Algorthim involves three steps:

        1). First each curve is divided into segments based on curvature and the length of the segments. Breaking the curves at places of high curvature is a heuristic that works because the TriangleMesh is assumed to be a tube, for example the colon or brachia in the lung. If the tube bends, then triangles on the far side of the curve are not visible.

        2). Second the radial distance from the curve through the TriangleMesh tube is calculated for each position on the curve. This distance is used to determine the maximum width of the tube for each position on the FlyPath curve.

        3). Third, the triangles are distributed into sub-meshes. Each sub-mesh represents the visible triangles along each of the curve segments. Because triangles associated with the adjacent curve segments are visible at the start and end of each curve segment, each sub-mesh contains the triangles for the previous curve segment, the current curve segment, and the next curve segment. If a branch occurs in the current curve segment, the triangles associated with the first segment on that branch curve are also included in the sub-mesh.

    • Method Detail

      • cleanUp

        public void cleanUp()
        Delete all member variables needed for the mesh segmentation, but not needed for getTriangleArrayIndices.
      • dispose

        public void dispose()
        DOCUMENT ME!
      • finalize

        public void finalize()
        DOCUMENT ME!
        Overrides:
        finalize in class java.lang.Object
      • getCurve

        public WildMagic.LibFoundation.Curves.Curve3f getCurve​(int iCurve)
        DOCUMENT ME!
        Parameters:
        iCurve - int
        Returns:
        Curve3
      • getTriangleArrayIndices

        public int[] getTriangleArrayIndices​(int iCurve,
                                             float fT)
        DOCUMENT ME!
        Parameters:
        iCurve - int
        fT - float
        Returns:
        int[] getTriangleArrayIndices, returns the submesh associated with the Curve = iCurve and the relative position on that curve equal to fT. If
      • getTriangleMesh

        public ModelTriangleMesh getTriangleMesh()
        DOCUMENT ME!
        Returns:
        ModelTriangleMesh
      • findCurveSegment

        protected int findCurveSegment​(int iCurve,
                                       float fRelativeDistance)
        DOCUMENT ME!
        Parameters:
        iCurve - DOCUMENT ME!
        fRelativeDistance - DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • findMaxMeshDistance

        protected void findMaxMeshDistance​(int iDownSample)
        DOCUMENT ME!
        Parameters:
        iDownSample - DOCUMENT ME!
      • segmentCurvesByTangent

        protected void segmentCurvesByTangent()
        segmentCurvesByTangent produces a segmentation of the curves stored in the m_akCurvePosition data member. The segmentation is based on how much the tangent of the curve changes from the last segment endpoint to the current position on the curve. If the angle between the tangent at the current position and the vector between the current position and the last segment endpoint is greater than 45 degrees, and the distance along the path between the current point and the last segment end point is greater than a 5% of the overall curve length, then the curve is split, and a new curve segment is started. If the new segment length is greater than 10% of the overall curve length, it is divided into two new segments each with half the length. The Curve segment endpoints, including the first start point at 0.0 and the last endpoint at 1.0, are stored in the data member m_aafBreakPoints as relative distances along the curve. The numbers of break points for each curve are stored in the data member m_aiNumBreakPoints. There will be m_aiNumBreakPoints - 1 mesh segments. The Curve is sampled based on the original voxel path sample points. These points are also used in the findMaxMeshDistance function, so they are stored in the data member m_aakCurvePos, the tangents at the sample points are also stored for later use in the data member m_aakTangent. The relative distances of each segment endpoint are stored in the data member m_aafReleativeLengths.
      • segmentMesh

        protected void segmentMesh​(int iDownSample)
        DOCUMENT ME!
        Parameters:
        iDownSample - DOCUMENT ME!