javax.media.jai
Class WarpGeneralPolynomial

java.lang.Object
  extended byjavax.media.jai.Warp
      extended byjavax.media.jai.WarpPolynomial
          extended byjavax.media.jai.WarpGeneralPolynomial
All Implemented Interfaces:
Serializable

public final class WarpGeneralPolynomial
extends WarpPolynomial

A general polynomial-based description of an image warp.

The mapping is defined by two bivariate polynomial functions X(x, y) and Y(x, y) that define the source X and Y positions that map to a given destination (x, y) pixel coordinate.

The functions X(x, y) and Y(x, y) have the form:

 SUM{i = 0 to n} {SUM{j = 0 to i}{a_ij*x^(i - j)*y^j}}
 

See Also:
WarpPolynomial, Serialized Form

Field Summary
 
Fields inherited from class javax.media.jai.WarpPolynomial
degree, postScaleX, postScaleY, preScaleX, preScaleY, xCoeffs, yCoeffs
 
Constructor Summary
WarpGeneralPolynomial(float[] xCoeffs, float[] yCoeffs)
          Constructs a WarpGeneralPolynomial with pre- and post-scale factors of 1.
WarpGeneralPolynomial(float[] xCoeffs, float[] yCoeffs, float preScaleX, float preScaleY, float postScaleX, float postScaleY)
          Constructs a WarpGeneralPolynomial with a given transform mapping destination pixels into source space.
 
Method Summary
 float[] warpSparseRect(int x, int y, int width, int height, int periodX, int periodY, float[] destRect)
          Computes the source subpixel positions for a given rectangular destination region, subsampled with an integral period.
 
Methods inherited from class javax.media.jai.WarpPolynomial
createWarp, getCoeffs, getDegree, getPostScaleX, getPostScaleY, getPreScaleX, getPreScaleY, getXCoeffs, getYCoeffs, mapDestPoint
 
Methods inherited from class javax.media.jai.Warp
mapDestRect, mapSourcePoint, mapSourceRect, warpPoint, warpPoint, warpRect, warpRect, warpSparseRect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WarpGeneralPolynomial

public WarpGeneralPolynomial(float[] xCoeffs,
                             float[] yCoeffs,
                             float preScaleX,
                             float preScaleY,
                             float postScaleX,
                             float postScaleY)
Constructs a WarpGeneralPolynomial with a given transform mapping destination pixels into source space. Note that this is a backward mapping as opposed to the forward mapping used in AffineOpImage.

The xCoeffs and yCoeffs parameters must contain the same number of coefficients, (n + 1)(n + 2)/2, for some n, where n is the non-negative degree power of the polynomial. The coefficients, in order, are associated with the terms:

 1, x, y, x^2, x*y, y^2, ..., x^n, x^(n - 1)*y, ..., x*y^(n - 1), y^n
 
and coefficients of value 0 cannot be omitted.

The destination pixel coordinates (the arguments to the X() and Y() functions) are given in normal integral pixel coordinates, while the output of the functions is given in fixed-point, subpixel coordinates with a number of fractional bits specified by the subsampleBitsH and subsampleBitsV parameters.

Parameters:
xCoeffs - The destination to source transform coefficients for the X coordinate.
yCoeffs - The destination to source transform coefficients for the Y coordinate.
preScaleX - The scale factor to apply to input (dst) X positions.
preScaleY - The scale factor to apply to input (dst) Y positions.
postScaleX - The scale factor to apply to output (src) X positions.
postScaleY - The scale factor to apply to output (src) Y positions.
Throws:
IllegalArgumentException - if arrays xCoeffs and yCoeffs do not have the correct number of entries.

WarpGeneralPolynomial

public WarpGeneralPolynomial(float[] xCoeffs,
                             float[] yCoeffs)
Constructs a WarpGeneralPolynomial with pre- and post-scale factors of 1.

Parameters:
xCoeffs - The destination to source transform coefficients for the X coordinate.
yCoeffs - The destination to source transform coefficients for the Y coordinate.
Throws:
IllegalArgumentException - if arrays xCoeffs and yCoeffs do not have the correct number of entries.
Method Detail

warpSparseRect

public float[] warpSparseRect(int x,
                              int y,
                              int width,
                              int height,
                              int periodX,
                              int periodY,
                              float[] destRect)
Computes the source subpixel positions for a given rectangular destination region, subsampled with an integral period.

Specified by:
warpSparseRect in class Warp
Parameters:
x - The minimum X coordinate of the destination region.
y - The minimum Y coordinate of the destination region.
width - The width of the destination region.
height - The height of the destination region.
periodX - The horizontal sampling period.
periodY - The vertical sampling period.
destRect - An int array containing at least 2*((width+periodX-1)/periodX)*((height+periodY-1)/periodY) elements, or null. If null, a new array will be constructed.
Returns:
a reference to the destRect parameter if it is non-null, or a new int array of length 2*width*height otherwise.
Throws:
ArrayBoundsException - if destRect array is too small