core.math
Class Vec2Transform

java.lang.Object
  extended bycore.math.Vec2Transform

public class Vec2Transform
extends java.lang.Object

Stores and operates on a 2-dimensional affine transformation. The transformation is given by = < m, o > s.t. v' = m*v + o.


Field Summary
protected  Mat2 matrix
          matrix = m, the linear transformation
protected  Vec2 origin
          origin = o, the translation
 
Constructor Summary
Vec2Transform(Vec2 origin, double scale)
          Constructs a new Vec2Transform = < scale*I, origin >
Vec2Transform(Vec2 origin, Mat2 matrix)
          Constructs a new Vec2Transform = < matrix, origin >
Vec2Transform(Vec2Transform transform)
          Constructs a new Vec2Transform = 'transform'
Vec2Transform(Vec2 origin, Vec2 xaxis, Vec2 yaxis)
          Constructs a new Vec2Transform = < [ xaxis, yaxis ], origin >
 
Method Summary
 Vec2Transform concatenate(Vec2Transform transform)
          Returns: a new Vec2Transform that is the concatenation of 'this' followed by 'transform'
 double getScale()
          Returns: the scaling of the transform, assuming it is rigid
 Vec2Transform invert()
          Returns: a new Vec2Transform that is the inverse of 'this'
 boolean isRigid()
          Returns: true if 'this' is a rigid transformation, otherwise false
 boolean isRigidScaled()
          Returns: true if 'this' is a scaled rigid transformation, else false
 Vec2Transform reflect(Vec2 d)
          Returns: a new Vec2Transform that is 'this' reflected across 'd'
 Vec2Transform rotate(double theta)
          Returns: a new Vec2Transform that is 'this' rotated counter-clockwise by 'theta'
 Vec2Transform scale(double scale)
          Returns: a new Vec2Transform that is 'this' scaled by 'scale'
 Vec2Transform translate(Vec2 origin)
          Returns: a new Vec2Transform that is 'this' translated by 'origin'
 Vec2 v(Vec2 p)
          Returns: a new Vec2 that is 'p' transformed by 'this'
 Vec2 V(Vec2 p)
          Transforms 'p' y 'this' Returns: resulting 'p'
 Vec2 V(Vec2 p, Vec2 v)
          Sets v to the transformation of 'p' by 'this' Returns: resulting 'v'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrix

protected Mat2 matrix
matrix = m, the linear transformation


origin

protected Vec2 origin
origin = o, the translation

Constructor Detail

Vec2Transform

public Vec2Transform(Vec2 origin,
                     double scale)
Constructs a new Vec2Transform = < scale*I, origin >


Vec2Transform

public Vec2Transform(Vec2 origin,
                     Mat2 matrix)
Constructs a new Vec2Transform = < matrix, origin >


Vec2Transform

public Vec2Transform(Vec2 origin,
                     Vec2 xaxis,
                     Vec2 yaxis)
Constructs a new Vec2Transform = < [ xaxis, yaxis ], origin >


Vec2Transform

public Vec2Transform(Vec2Transform transform)
Constructs a new Vec2Transform = 'transform'

Method Detail

invert

public Vec2Transform invert()
Returns: a new Vec2Transform that is the inverse of 'this'


concatenate

public Vec2Transform concatenate(Vec2Transform transform)
Returns: a new Vec2Transform that is the concatenation of 'this' followed by 'transform'


translate

public Vec2Transform translate(Vec2 origin)
Returns: a new Vec2Transform that is 'this' translated by 'origin'


scale

public Vec2Transform scale(double scale)
Returns: a new Vec2Transform that is 'this' scaled by 'scale'


rotate

public Vec2Transform rotate(double theta)
Returns: a new Vec2Transform that is 'this' rotated counter-clockwise by 'theta'


reflect

public Vec2Transform reflect(Vec2 d)
Returns: a new Vec2Transform that is 'this' reflected across 'd'


isRigid

public boolean isRigid()
Returns: true if 'this' is a rigid transformation, otherwise false


isRigidScaled

public boolean isRigidScaled()
Returns: true if 'this' is a scaled rigid transformation, else false


getScale

public double getScale()
Returns: the scaling of the transform, assuming it is rigid


v

public Vec2 v(Vec2 p)
Returns: a new Vec2 that is 'p' transformed by 'this'


V

public Vec2 V(Vec2 p)
Transforms 'p' y 'this' Returns: resulting 'p'


V

public Vec2 V(Vec2 p,
              Vec2 v)
Sets v to the transformation of 'p' by 'this' Returns: resulting 'v'