Class RVFTransform3D

java.lang.Object
org.bzdev.geom.RVFTransform3D
All Implemented Interfaces:
Cloneable, Transform3D

public class RVFTransform3D extends Object implements Transform3D, Cloneable
Class to create a Transform3D based on real-valued functions of three arguments.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    affineTransform(double x, double y, double z)
    Get the AffineTransform3D that approximates this transform in a neighborhood of a point whose coordinates are (x, y, z).
    Clone this object.
    void
    transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
    Apply this transform to a sequence of points with the source points' coordinates specified as double-precision numbers and the destination points' coordinates specified as double-precision numbers.
    void
    transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
    Apply this transform to a sequence of points with the source points' coordinates specified as double-precision numbers and the destination points' coordinates specified as single-precision numbers.
    void
    transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
    Apply this transform to a sequence of points with the source points' coordinates specified as single-precision numbers and the destination points' coordinates specified as double-precision numbers.
    void
    transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
    Apply this transform to a sequence of points with the source points' coordinates specified as single-precision numbers and the destination points' coordinates specified as single-precision numbers.
    transform(Point3D ptSrc, Point3D ptDst)
    Apply this transform to a single point, optionally storing the transformed value in a specified point.

    Methods inherited from class java.lang.Object

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

    • RVFTransform3D

      public RVFTransform3D(RealValuedFunctThreeOps xfunct, RealValuedFunctThreeOps yfunct, RealValuedFunctThreeOps zfunct)
      Constructor. For this transform to successfully return the affine transform that approximates this transform at the point (x, y, z), the functions xfunct, yfunct, and zfunct must be able to evaluate their first derivatives. If these derivatives are not implemented, an UnsupportedOperationException will be thrown when affineTransform(double,double,double) is called.
      Parameters:
      xfunct - the real-valued function providing the X coordinate of a transformed point given the original point's X, Y, and Z coordinates.
      yfunct - the real-valued function providing the Y coordinate of a transformed point given the original point's X, Y, and Z coordinates.
      zfunct - the real-valued function providing the Z coordinate of a transformed point given the original point's X, Y, and Z coordinates.
  • Method Details

    • transform

      public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Description copied from interface: Transform3D
      Apply this transform to a sequence of points with the source points' coordinates specified as double-precision numbers and the destination points' coordinates specified as double-precision numbers. Each point is an ordered triplet (px,py,pz stored as consecutive array elements in that order.

      If srcPts and dstPts are the same array, overlaps will be handle automatically unless documentation for a subclass states otherwise.

      Specified by:
      transform in interface Transform3D
      Parameters:
      srcPts - the points to transform
      srcOff - the offset into srcPts at which the first point is stored
      dstPts - the transformed points
      dstOff - the offset into dstPts at which the first transformed point will be stored
      numPts - the number of points
    • transform

      public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
      Description copied from interface: Transform3D
      Apply this transform to a sequence of points with the source points' coordinates specified as double-precision numbers and the destination points' coordinates specified as single-precision numbers. Each point is an ordered triplet (px,py,pz stored as consecutive array elements in that order.
      Specified by:
      transform in interface Transform3D
      Parameters:
      srcPts - the points to transform
      srcOff - the offset int srcPts at which the first point is stored
      dstPts - the transformed points
      dstOff - the offset in dstPts at which the first transformed point will be stored
      numPts - the number of points
    • transform

      public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts)
      Description copied from interface: Transform3D
      Apply this transform to a sequence of points with the source points' coordinates specified as single-precision numbers and the destination points' coordinates specified as single-precision numbers. Each point is an ordered triplet (px,py,pz stored as consecutive array elements in that order.

      If srcPts and dstPts are the same array, overlaps will be handle automatically unless documentation for a subclass states otherwise.

      Specified by:
      transform in interface Transform3D
      Parameters:
      srcPts - the points to transform
      srcOff - the offset int srcPts at which the first point is stored
      dstPts - the transformed points
      dstOff - the offset in dstPts at which the first transformed point will be stored
      numPts - the number of points
    • transform

      public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)
      Description copied from interface: Transform3D
      Apply this transform to a sequence of points with the source points' coordinates specified as single-precision numbers and the destination points' coordinates specified as double-precision numbers. Each point is an ordered triplet (px,py,pz stored as consecutive array elements in that order.
      Specified by:
      transform in interface Transform3D
      Parameters:
      srcPts - the points to transform
      srcOff - the offset int srcPts at which the first point is stored
      dstPts - the transformed points
      dstOff - the offset in dstPts at which the first transformed point will be stored
      numPts - the number of points
    • transform

      public Point3D transform(Point3D ptSrc, Point3D ptDst)
      Description copied from interface: Transform3D
      Apply this transform to a single point, optionally storing the transformed value in a specified point. Note: ptSrc and ptDst can be the same point.
      Specified by:
      transform in interface Transform3D
      Parameters:
      ptSrc - the untransformed point
      ptDst - the point to be transformed (a new point will be created if the value is null)
      Returns:
      the transformed point
    • affineTransform

      public AffineTransform3D affineTransform(double x, double y, double z) throws UnsupportedOperationException
      Description copied from interface: Transform3D
      Get the AffineTransform3D that approximates this transform in a neighborhood of a point whose coordinates are (x, y, z).

      If a transform is represented by the equations

          x' = f(x,y,z)
          y' = g(x,y,z)
          z' = h(x,y,z)
       
      and the first partial derivatives of f, g, and h exist, then we can approximate the transform at a point (x0,y0,z0) by
          x' = f(x0,y0,z0) + f1(x0,y0,z0)(x-x0) + f2(x0,y0,z0)(y-y0) + f3(x0,y0,z0)(z-z0)
          y' = g(x0,y0,z0) + g1(x0,y0,z0)(x-x0) + g2(x0,y0,z0)(y-y0) + g3(x0,y0,z0)(z-z0)
          z' = h(x0,y0,z0) + h1(x0,y0,z0)(x-x0) + h2(x0,y0,z0)(y-y0) + h3(x0,y0,z0)(z-z0)
       
      This set of equations represents an affine transform whose non-translation components are
         m00 = f1(x0,y0,z0)
         m10 = g1(x0,y0,z0)
         m20 = h1(x0,y0,z0)
         m01 = f2(x0,y0,z0)
         m11 = g2(x0,y0,z0)
         m21 = h2(x0,y0,z0)
         m02 = f3(x0,y0,z0)
         m12 = g3(x0,y0,z0)
         m22 = h3(x0,y0,z0)
       
      and whose translation components are
          m03 = f(x0,y0,z0) - f1(x0,y0,z0)x0 - f2(x0,y0,z0)y0 - f3(x0,y0,z0)z0
          m13 = g(x0,y0,z0) - g1(x0,y0,z0)x0 - g2(x0,y0,z0)y0 - g3(x0,y0,z0)z0
          m23 = h(x0,y0,z0) - h1(x0,y0,z0)x0 - h2(x0,y0,z0)y0 - h3(x0,y0,z0)z0
       
      that is a good approximation to this transform in a sufficiently small neighborhood of the point (x0,y0,z0).
      Specified by:
      affineTransform in interface Transform3D
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      z - the Z coordinate
      Returns:
      an AffineTransform3D that approximates this transform; null if one does not exist at the point whose coordinates are (x, y, z)
      Throws:
      UnsupportedOperationException - this operation is not supported by this transform
    • clone

      public Object clone() throws CloneNotSupportedException
      Clone this object.
      Overrides:
      clone in class Object
      Returns:
      a copy of this object
      Throws:
      CloneNotSupportedException - this instance cannot be cloned