net.aerith.misao.util
Class DistortionField

java.lang.Object
  |
  +--net.aerith.misao.util.DistortionField

public class DistortionField
extends java.lang.Object

The DistortionField represents distortion of (x,y) positions by cubic function.

The constructor requires the list of pair of Position data. The distortion field represents the difference of (x,y) positions. The method getValue requires the (x,y) position of the first element of pair and returns the difference between the (x,y) position of the second element of pair.

The relations among these values are as follows.

     (dx, dy) = getValue (x1, y1)
     (x2, y2) = (x1, y1) + (dx, dy)
 


Field Summary
 Cubics cubics_dx
          The cubic function to calculate distortion of x.
 Cubics cubics_dy
          The cubic function to calculate distortion of y.
 
Constructor Summary
DistortionField()
          Constructs a flat DistortionField.
DistortionField(java.util.Vector pair_list)
          Constructs a DistortionField based on the specified list of pairs of Position data.
 
Method Summary
 Position getValue(Position pos)
          Gets the distortion value at the specified position.
 DistortionField inverse()
          Gets the inverse function of this distortion field.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

cubics_dx

public Cubics cubics_dx
The cubic function to calculate distortion of x.

cubics_dy

public Cubics cubics_dy
The cubic function to calculate distortion of y.
Constructor Detail

DistortionField

public DistortionField()
Constructs a flat DistortionField.

DistortionField

public DistortionField(java.util.Vector pair_list)
Constructs a DistortionField based on the specified list of pairs of Position data.
Parameters:
pair_list - the list of pairs of Position data.
Method Detail

inverse

public DistortionField inverse()
Gets the inverse function of this distortion field.
Returns:
the inverse function of this distortion field.

getValue

public Position getValue(Position pos)
Gets the distortion value at the specified position.
Returns:
the distortion value at the specified position.