lt.monarch.chart.chart2D.engine
Class Transformation

java.lang.Object
  extended by lt.monarch.chart.chart2D.engine.Transformation
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Transformation
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Class responsible for transforming coordinates according to transformation matrix or specified angle of rotation (matrix is formed then).

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  int dimension
          Dimension of the transformation matrix.
protected  double[] matrix
           
 
Constructor Summary
Constructor and Description
Transformation()
          Default transformation matrix constructor, which has no effect on transforming point.
Transformation(double angle)
          Transformation matrix constructor
Transformation(double m00, double m10, double m01, double m11, double m02, double m12)
          Transformation matrix constructor
 
Method Summary
Modifier and Type Method and Description
protected  java.lang.Object clone()
           
 java.awt.geom.AffineTransform getAffineTransform()
          Returns affine transformation
 double getXScale()
          Gets the x scale
 double getXShear()
          Gets x shear
 double getXShift()
          Gets x shift
 double getYScale()
          Gets y scale
 double getYShear()
          Gets y shear
 double getYShift()
          Gets y shift
 void setXScale(double value)
          Sets the x scale
 void setXShear(double value)
          Sets x shear
 void setXShift(double value)
          Sets x shift
 void setYScale(double value)
          Sets y scale
 void setYShear(double value)
          Sets y shear
 void setYShift(double value)
          Sets y shift
 Point2D transform(Point2D vectorPoint, double x, double y)
          Transforms the point according to transformation matrix
 Point2D transform(Point2D vectorPoint, Point2D anchor)
          Transforms the point according a transformation matrix
 Rectangle2D transform(Rectangle2D bounds)
          Transforms rectangle bounds according a transformation matrix
 void transformInplace(Point2D vectorPoint, double x, double y)
          Transforms the point according to transformation matrix.
 Rectangle2D transformInplace(Rectangle2D bounds)
          Transforms rectangle bounds according a transformation matrix.
 void transformWithoutTranslateInplace(Point2D vectorPoint)
          Transforms the point according a transformation matrix.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrix

protected double[] matrix

dimension

protected int dimension
Dimension of the transformation matrix. for 2D is 2, for 3D is 3

Constructor Detail

Transformation

public Transformation()
Default transformation matrix constructor, which has no effect on transforming point.


Transformation

public Transformation(double m00,
                      double m10,
                      double m01,
                      double m11,
                      double m02,
                      double m12)
Transformation matrix constructor

Parameters:
m00 - 0 row, 0 column value. X scale.
m10 - 1 row, 0 column value. X shear.
m01 - 0 row, 1 column value. Y shear.
m11 - 1 row, 1 column value. Y scale.
m02 - 0 row, 2 column value. X shift.
m12 - 1 row, 2 column value. Y shift.

Transformation

public Transformation(double angle)
Transformation matrix constructor

Parameters:
angle - point rotation angle in radians.
Method Detail

transform

public Point2D transform(Point2D vectorPoint,
                         double x,
                         double y)
Transforms the point according to transformation matrix

Parameters:
vectorPoint - the point to transform
x - x anchor point
y - y anchor point
Returns:
transformed point

transformInplace

public void transformInplace(Point2D vectorPoint,
                             double x,
                             double y)
Transforms the point according to transformation matrix. Points values are replaced with transformed values.

Parameters:
vectorPoint - the point to transform
x - x anchor point
y - y anchor point

transform

public Point2D transform(Point2D vectorPoint,
                         Point2D anchor)
Transforms the point according a transformation matrix

Parameters:
vectorPoint - the point to transform
anchor - anchor point
Returns:
transformed point

transformWithoutTranslateInplace

public void transformWithoutTranslateInplace(Point2D vectorPoint)
Transforms the point according a transformation matrix. Skips translation.

Parameters:
vectorPoint - the point to transform

transform

public Rectangle2D transform(Rectangle2D bounds)
Transforms rectangle bounds according a transformation matrix

Parameters:
bounds - rectangle bounds as double values
Returns:
Transformed rectangle with double values

transformInplace

public Rectangle2D transformInplace(Rectangle2D bounds)
Transforms rectangle bounds according a transformation matrix. Rectangle values are replaced with transformed values.

Parameters:
bounds - rectangle bounds as double values

getXScale

public double getXScale()
Gets the x scale

Returns:
x scale

getYScale

public double getYScale()
Gets y scale

Returns:
y scale

getXShift

public double getXShift()
Gets x shift

Returns:
x shift

getYShift

public double getYShift()
Gets y shift

Returns:
y shift

getXShear

public double getXShear()
Gets x shear

Returns:
x shift

getYShear

public double getYShear()
Gets y shear

Returns:
y shift

setXScale

public void setXScale(double value)
Sets the x scale

Parameters:
value - x scale

setYScale

public void setYScale(double value)
Sets y scale

Parameters:
value - y scale

setXShift

public void setXShift(double value)
Sets x shift

Parameters:
value - x shift

setYShift

public void setYShift(double value)
Sets y shift

Parameters:
value - y shift

setXShear

public void setXShear(double value)
Sets x shear

Parameters:
value - x shift

setYShear

public void setYShear(double value)
Sets y shear

Parameters:
value - y shift

clone

protected java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getAffineTransform

public java.awt.geom.AffineTransform getAffineTransform()
Returns affine transformation

Returns:
affine transformation