Class Path2DInfo.SegmentData

java.lang.Object
org.bzdev.geom.Path2DInfo.SegmentData
Enclosing class:
Path2DInfo

public static final class Path2DInfo.SegmentData extends Object
Class to store values used in computations on a segment of a path.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SegmentData(int st, double x0, double y0, double[] coords, Path2DInfo.SegmentData last)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Compute the signed curvature at a point with a given path parameter If the path segment's type is PathIterator.SEG_CLOSE, the starting and ending points of the segment are identical, and the path parameter corresponding to the argument is zero, the curvature at the end of the previous segment is returned.
    boolean
    Determine if the curvature exists for the specified argument.
    double
    Compute the second derivative with respect to the path parameter of the signed distance along the path from its initial point
    double
    Compute the second derivative with respect to the path parameter of the X coordinate of a point on the path.
    double
    Compute the second derivative with respect to the path parameter of the Y coordinate of a point on the path.
    double
    Compute the third derivative with respect to the path parameter of the X coordinate of a point on the path.
    double
    Compute the third derivative with respect to the path parameter of the Y coordinate of a point on the path.
    double
    Compute the derivative with respect to the path parameter of the signed distance along the path from its initial point
    double
    Compute the derivative with respect to the path parameter of the X coordinate of a point on the path.
    double
    Compute the derivative with respect to the path parameter of the Y coordinate of a point on the path.
    boolean
    getNormal(Path2DInfo.UValues uv, double[] array, int offset)
    Get the normal vector for a given value of the path parameter and an offset for the array storing the normal vector.
    boolean
    getTangent(Path2DInfo.UValues uv, double[] array, int offset)
    Get the tangent vector for a specified value of the path parameter and an output-array offset.
    int
    Get the type for this segment
    double
    Compute the X coordinate of a point on the path.
    double
    Compute the X coordinate of a point on the path.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • getX

      public double getX(Path2DInfo.UValues uv)
      Compute the X coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the X coordinate
    • getY

      public double getY(Path2DInfo.UValues uv)
      Compute the X coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the Y coordinate
    • dxDu

      public double dxDu(Path2DInfo.UValues uv)
      Compute the derivative with respect to the path parameter of the X coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the derivative of the X coordinate with respect to the path parameter
    • dyDu

      public double dyDu(Path2DInfo.UValues uv)
      Compute the derivative with respect to the path parameter of the Y coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the derivative of the Y coordinate with respect to the path parameter
    • d2xDu2

      public double d2xDu2(Path2DInfo.UValues uv)
      Compute the second derivative with respect to the path parameter of the X coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the second derivative of the X coordinate with respect to the path parameter
    • d3xDu3

      public double d3xDu3(Path2DInfo.UValues uv)
      Compute the third derivative with respect to the path parameter of the X coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the third derivative of the X coordinate with respect to the path parameter
    • d3yDu3

      public double d3yDu3(Path2DInfo.UValues uv)
      Compute the third derivative with respect to the path parameter of the Y coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the third derivative of the X coordinate with respect to the path parameter
    • d2yDu2

      public double d2yDu2(Path2DInfo.UValues uv)
      Compute the second derivative with respect to the path parameter of the Y coordinate of a point on the path.
      Parameters:
      uv - the path parameter
      Returns:
      the second derivative of the Y coordinate with respect to the path parameter
    • dsDu

      public double dsDu(Path2DInfo.UValues uv)
      Compute the derivative with respect to the path parameter of the signed distance along the path from its initial point
      Parameters:
      uv - the path parameter
      Returns:
      the derivative of the signed distance along the path with respect to the path parameter
    • d2sDu2

      public double d2sDu2(Path2DInfo.UValues uv)
      Compute the second derivative with respect to the path parameter of the signed distance along the path from its initial point
      Parameters:
      uv - the path parameter
      Returns:
      the second derivative of the signed distance along the path with respect to the path parameter
    • curvature

      public double curvature(Path2DInfo.UValues uv)
      Compute the signed curvature at a point with a given path parameter If the path segment's type is PathIterator.SEG_CLOSE, the starting and ending points of the segment are identical, and the path parameter corresponding to the argument is zero, the curvature at the end of the previous segment is returned. A positive curvature corresponds to a rotation from the positive X axis towards the positive Y axis for an angular distance of 90 degrees. Similarly a negative curvature corresponds to a rotation from the positive Y axis towards the positive X axis for an angular distance of 90 degrees.
      Parameters:
      uv - the path parameter
      Returns:
      the curvature (Double.NaN if not defined) with positive values indicating that the tangent vector rotates counterclockwise as the path parameter increases
    • curvatureExists

      public boolean curvatureExists(Path2DInfo.UValues uv)
      Determine if the curvature exists for the specified argument. In general, the curvature does not exist when all the points along a segment are the same point or when the segment is a SEG_MOVETO segment (which just indicates the start of a curve). For a SEG_CLOSE segment where the starting and ending points are identical, the curvature exists if the curvature of the previous segment exists at its end (u = 1.0).
      Parameters:
      uv - the path parameter
      Returns:
      true if the curvature exists; false otherwise
    • getType

      public int getType()
      Get the type for this segment
      Returns:
      the type of this segment, legal values of which are PathIterator.SEG_MOVETO, PathIterator.SEG_LINETO, PathIterator.SEG_QUADTO, PathIterator.SEG_CUBICTO, and PathIterator.SEG_CLOSE.
    • getTangent

      public boolean getTangent(Path2DInfo.UValues uv, double[] array, int offset)
      Get the tangent vector for a specified value of the path parameter and an output-array offset. If the tangent vector does not exist (e.g., the length of the line does not vary with the path parameter), the tangent vector will be set to zero. The tangent vector will have unit length if it is not zero.
      Parameters:
      uv - the path parameter
      array - an array of length no less than 2 used to store the tangent vector, with array[offset] containing the tangent vector's X component and array[offset+1] containing the tangent vector's Y component
      offset - the index into the array at which to store the tangent vector
      Returns:
      true if the tangent vector exists; false if the tangent vector does not exist
    • getNormal

      public boolean getNormal(Path2DInfo.UValues uv, double[] array, int offset)
      Get the normal vector for a given value of the path parameter and an offset for the array storing the normal vector. The normal vector N is a vector of unit length, perpendicular to the tangent vector, and oriented so that d2r/ds2 = κN where κ is the (signed) curvature. If the normal vector does not exist (e.g., the length of the line does not vary with the path parameter), the normal vector will be set to zero.

      Note: the use of the signed curvature results in the normal vector always pointing in the counter-clockwise direction (i.e., a rotating the X axis towards the Y axis). This allows a normal vector exist for straight-line segments. A different definition is used for 3D paths.

      Parameters:
      uv - the path parameter
      array - an array of length no less than 2 used to store the normal vector, with array[offset] containing the normal vector's X component and array[offset+1] containing the normal vector's Y component
      offset - the index into the array at which to store the normal vector
      Returns:
      true if the normal vector exists; false if the normal vector does not exist