Class AlgorithmArcLength

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmArcLength
    extends AlgorithmBase
    This algorithm calculates the arc-length of a Bspline fit to user defined control points. This algorithm calculates the entire curve length and also is able to calculate the arc-length between two points.
    Version:
    0.1 April 27, 1998
    • Field Detail

      • INVLEN_TOLERANCE

        public static final float INVLEN_TOLERANCE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • rom

        private float[][] rom
        DOCUMENT ME!
      • totalLen

        private float totalLen
        DOCUMENT ME!
      • xPoints

        private float[] xPoints
        DOCUMENT ME!
      • yPoints

        private float[] yPoints
        DOCUMENT ME!
      • zPoints

        private float[] zPoints
        DOCUMENT ME!
    • Constructor Detail

      • AlgorithmArcLength

        public AlgorithmArcLength​(float[] xPts,
                                  float[] yPts)
        Algorithm constructor.
        Parameters:
        xPts - x coordinate control points
        yPts - y coordinate control points
      • AlgorithmArcLength

        public AlgorithmArcLength​(float[] xPts,
                                  float[] yPts,
                                  float[] zPts)
        Algorithm constructor.
        Parameters:
        xPts - x coordinate control points
        yPts - y coordinate control points
    • Method Detail

      • getTotalArcLength

        public float getTotalArcLength()
        Returns total arc-length of the segment.
        Returns:
        DOCUMENT ME!
      • invlen

        public float invlen​(float pct)
        Finds the point at some percentage along the curve using simple midpoint root finding algorithm.
        Parameters:
        pct - percentage indicating where one would
        Returns:
        position indicates
      • invlenNewton

        public float invlenNewton​(float pct)
        Finds the point at some percentage along the curve using Newtons method of root finding.
        Parameters:
        pct - percentage indicating where one would
        Returns:
        position indicates
      • setPoints

        public void setPoints​(float[] xPts,
                              float[] yPts)
        Sets the controls points of the Bspline and calculates the total arc-length.
        Parameters:
        xPts - x coordinate control points
        yPts - y coordinate control points
      • setPoints

        public void setPoints​(float[] xPts,
                              float[] yPts,
                              float[] zPts)
        Sets the controls points of the Bspline and calculates the total arc-length.
        Parameters:
        xPts - x coordinate control points
        yPts - y coordinate control points
      • length

        public float length​(float a,
                            float b)
        The length is calculated between to points a,b using Romberg integration.
        Parameters:
        a - starting position
        b - ending position b > a and b range
        Returns:
        length returns arc-length of the segment
      • speed

        private float speed​(float q)
        Calculates the speed at some point q.
        Parameters:
        q - the point where the speed is calculated
        Returns:
        speed the speed ( magnitude ) is returned