java.lang.Object
org.bzdev.geom.RVFTransform2D
- All Implemented Interfaces:
Cloneable
,Transform2D
Class to create a Transform2D based on real-valued functions of
two arguments.
-
Constructor Summary
ConstructorsConstructorDescriptionRVFTransform2D
(RealValuedFunctionTwo xfunct, RealValuedFunctionTwo yfunct) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionaffineTransform
(double x, double y) Get the AffineTransform that approximates this transform in a neighborhood of a point whose coordinates are (x, y, z).clone()
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.Apply this transform to a single point, optionally storing the transformed value in a specified point.
-
Constructor Details
-
RVFTransform2D
Constructor. For this transform to successfully return the affine transform that approximates this transform at the point (x, y), the functions xfunct and yfunct must be able to evaluate their first derivatives. If these derivatives are not implemented, anUnsupportedOperationException
will be thrown whenaffineTransform(double,double)
is called.- Parameters:
xfunct
- the real-valued function providing the X coordinate of a transformed point given the original point's X and Y coordinates.yfunct
- the real-valued function providing the Y coordinate of a transformed point given the original point's X and Y coordinates.
-
-
Method Details
-
transform
public void transform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Description copied from interface:Transform2D
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 interfaceTransform2D
- Parameters:
srcPts
- the points to transformsrcOff
- the offset into srcPts at which the first point is storeddstPts
- the transformed pointsdstOff
- the offset into dstPts at which the first transformed point will be storednumPts
- the number of points
-
transform
public void transform(double[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Description copied from interface:Transform2D
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 interfaceTransform2D
- Parameters:
srcPts
- the points to transformsrcOff
- the offset int srcPts at which the first point is storeddstPts
- the transformed pointsdstOff
- the offset in dstPts at which the first transformed point will be storednumPts
- the number of points
-
transform
public void transform(float[] srcPts, int srcOff, float[] dstPts, int dstOff, int numPts) Description copied from interface:Transform2D
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 interfaceTransform2D
- Parameters:
srcPts
- the points to transformsrcOff
- the offset int srcPts at which the first point is storeddstPts
- the transformed pointsdstOff
- the offset in dstPts at which the first transformed point will be storednumPts
- the number of points
-
transform
public void transform(float[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) Description copied from interface:Transform2D
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 interfaceTransform2D
- Parameters:
srcPts
- the points to transformsrcOff
- the offset int srcPts at which the first point is storeddstPts
- the transformed pointsdstOff
- the offset in dstPts at which the first transformed point will be storednumPts
- the number of points
-
transform
Description copied from interface:Transform2D
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 interfaceTransform2D
- Parameters:
ptSrc
- the untransformed pointptDst
- the point to be transformed (a new point will be created if the value is null)- Returns:
- the transformed point
-
affineTransform
Description copied from interface:Transform2D
Get the AffineTransform 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) y' = g(x,y)
and the first partial derivatives of f and g exist, then we can approximate the transform at a point (x0,y0) byx' = f(x0,y0) + f1(x0,y0)(x-x0) + f2(x0,y0)(y-y0) + f3(x0,y0)(z-z0) y' = g(x0,y0) + g1(x0,y0)(x-x0) + g2(x0,y0)(y-y0) + g3(x0,y0)(z-z0)
This set of equations represents an affine transform whose non-translation components arem00 = f1(x0,y0) m10 = g1(x0,y0) m01 = f2(x0,y0) m11 = g2(x0,y0)
and whose translation components arem02 = f(x0,y0) - f1(x0,y0)x0 - f2(x0,y0)y0 m12 = g(x0,y0) - g1(x0,y0)x0 - g2(x0,y0)y0
that is a good approximation to this transform in a sufficiently small neighborhood of the point (x0,y0).- Specified by:
affineTransform
in interfaceTransform2D
- Parameters:
x
- the X coordinatey
- the Y coordinate- Returns:
- an AffineTransform2D 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
Clone this object.- Overrides:
clone
in classObject
- Returns:
- a copy of this object
- Throws:
CloneNotSupportedException
- this instance cannot be cloned
-