Class BasicSplinePath3D.Location

java.lang.Object
org.bzdev.geom.BasicSplinePath3D.Location
Enclosing class:
BasicSplinePath3D

public class BasicSplinePath3D.Location extends Object
Class representing a location along a path that is an instance of BasicSplinePath3D. A location is associated with a position along a path - a particular value of the path parameter - and stores data that allows various quantities to be computed with higher efficiency than would otherwise be possible. It is useful for the case where multiple quantities will be computed for the same location.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Compute the curvature at the point along the path corresponding to this location.
    boolean
    Determine if the curvature exists at the point along the path corresponding to this location.
    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, evaluated at the point along the path corresponding to this location.
    double
    Compute the second derivative with respect to the path parameter of the Y coordinate, evaluated at the point along the path corresponding to this location.
    double
    Compute the second derivative with respect to the path parameter of the Z coordinate, evaluated at the point along the path corresponding to this location.
    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 for the point along the path corresponding to this location.
    double
    Compute the derivative with respect to the path parameter of the Y coordinate for the point along the path corresponding to this location.
    double
    Compute the derivative with respect to the path parameter of the Z coordinate for the point along the path corresponding to this location.
    boolean
    getBinormal(double[] array, int offset)
    Get the binormal vector for the point along the path corresponding to this location.
    boolean
    getNormal(double[] array, int offset)
    Get the normal vector for the point along the path corresponding to this location.
    double
    Get the path parameter corresponding to this location along the path.
    Get the point along the path corresponding to this location.
    boolean
    getTangent(double[] array, int offset)
    Get the tangent vector for the point along the path corresponding to this location.
    double
    Get the X coordinate of the point along the path corresponding to this location.
    double
    Get the Y coordinate of the point along the path corresponding to this location.
    double
    Get the Y coordinate of the point along the path corresponding to this location.
    double
    Compute the torsion at the point along the path corresponding to this location.

    Methods inherited from class java.lang.Object

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

    • getPathParameter

      public double getPathParameter()
      Get the path parameter corresponding to this location along the path.
      Returns:
      the path parameter
    • getPoint

      public Point3D getPoint()
      Get the point along the path corresponding to this location.
      Returns:
      the point along the path
      Throws:
      IllegalStateException - this location is no longer valid
    • getX

      public double getX()
      Get the X coordinate of the point along the path corresponding to this location.
      Returns:
      the X coordinate
      Throws:
      IllegalStateException - this location is no longer valid
    • getY

      public double getY()
      Get the Y coordinate of the point along the path corresponding to this location.
      Returns:
      the Y coordinate
      Throws:
      IllegalStateException - this location is no longer valid
    • getZ

      public double getZ()
      Get the Y coordinate of the point along the path corresponding to this location.
      Returns:
      the Y coordinate
      Throws:
      IllegalStateException - this location is no longer valid
    • dxDu

      public double dxDu()
      Compute the derivative with respect to the path parameter of the X coordinate for the point along the path corresponding to this location.
      Returns:
      the derivative of the X coordinate with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • dyDu

      public double dyDu()
      Compute the derivative with respect to the path parameter of the Y coordinate for the point along the path corresponding to this location.
      Returns:
      the derivative of the Y coordinate with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • dzDu

      public double dzDu()
      Compute the derivative with respect to the path parameter of the Z coordinate for the point along the path corresponding to this location.
      Returns:
      the derivative of the Y coordinate with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • d2xDu2

      public double d2xDu2()
      Compute the second derivative with respect to the path parameter of the X coordinate, evaluated at the point along the path corresponding to this location.
      Returns:
      the second derivative of the X coordinate with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • d2yDu2

      public double d2yDu2()
      Compute the second derivative with respect to the path parameter of the Y coordinate, evaluated at the point along the path corresponding to this location.
      Returns:
      the second derivative of the Y coordinate with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • d2zDu2

      public double d2zDu2()
      Compute the second derivative with respect to the path parameter of the Z coordinate, evaluated at the point along the path corresponding to this location.
      Returns:
      the second derivative of the Y coordinate with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • dsDu

      public double dsDu()
      Compute the derivative with respect to the path parameter of the signed distance along the path from its initial point. The derivative is evaluated at the point along the path corresponding to this location.
      Returns:
      the derivative of the signed distance along the path with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • d2sDu2

      public double d2sDu2()
      Compute the second derivative with respect to the path parameter of the signed distance along the path from its initial point. The derivative is evaluated at the point along the path corresponding to this location.
      Returns:
      the second derivative of the signed distance along the path with respect to the path parameter
      Throws:
      IllegalStateException - this location is no longer valid
    • curvature

      public double curvature()
      Compute the curvature at the point along the path corresponding to this location. If the current path segment's type is PathIterator3D.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.
      Returns:
      the curvature (Double.NaN if not defined)
      Throws:
      IllegalStateException - this location is no longer valid
    • torsion

      public double torsion()
      Compute the torsion at the point along the path corresponding to this location. If the current path segment's type is PathIterator3D.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

      The Wikipedia page The Frenet-Serret Formulas contains a definition.

      Returns:
      the torsion (Double.NaN if not defined)
      Throws:
      IllegalStateException - this location is no longer valid
    • curvatureExists

      public boolean curvatureExists()
      Determine if the curvature exists at the point along the path corresponding to this location. 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).
      Returns:
      true if the curvature exists; false otherwise
      Throws:
      IllegalStateException - this location is no longer valid
    • getTangent

      public boolean getTangent(double[] array, int offset)
      Get the tangent vector for the point along the path corresponding to this location. 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:
      array - an array of length no less than 3 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
      Throws:
      IllegalStateException - this location is no longer valid
    • getNormal

      public boolean getNormal(double[] array, int offset)
      Get the normal vector for the point along the path corresponding to this location. 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.
      Parameters:
      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
      Throws:
      IllegalStateException - this location is no longer valid
    • getBinormal

      public boolean getBinormal(double[] array, int offset)
      Get the binormal vector for the point along the path corresponding to this location. The binormal vector B is equals to the cross product T X N, where T is the tangent vector and N is 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 curvature. If the normal vector does not exist (e.g., the length of the line does not vary with the path parameter or the path is locally straight), the binormal vector will be set to zero.
      Parameters:
      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
      Throws:
      IllegalStateException - this location is no longer valid