com.sencha.gxt.chart.client.draw
Class Matrix

java.lang.Object
  extended by com.sencha.gxt.chart.client.draw.Matrix

public class Matrix
extends Object

Matrix class representing the vector transform matrix used in SVG and VML.


Constructor Summary
Matrix()
          Creates a new identity matrix.
Matrix(double a, double b, double c, double d, double e, double f)
          Creates a new matrix using the given double values.
Matrix(Matrix clone)
          Creates a clone of the given matrix.
 
Method Summary
 void add(double a, double b, double c, double d, double e, double f)
          Adds the given matrix to this matrix.
 double get(int row, int column)
          Returns the element of the matrix at the given row and column.
 double[][] getMatrix()
          Returns the array of element data.
 void identity()
          Sets this matrix to the identity matrix.
 Matrix invert()
          Returns the inverse of this matrix.
 PrecisePoint pointMultiply(PrecisePoint point)
          Multiplies the matrix by the given point and returns the result.
 void prepend(double a, double b, double c, double d, double e, double f)
          Prepend this matrix with the given matrix.
 void rotate(double angle, double x, double y)
          Rotates the matrix using the given angle and arbitrary axis.
 void scale(double x, double y, double cx, double cy)
          Scales the matrix using given x and y scale and the given origin
 void set(int row, int column, double value)
          Sets an element of the matrix using the given value at the specified row and column.
 void setMatrix(double[][] matrix)
          Sets the element data of the matrix using the given array.
 void translate(double x, double y)
          Translates the matrix using the given x and y values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix()
Creates a new identity matrix.


Matrix

public Matrix(double a,
              double b,
              double c,
              double d,
              double e,
              double f)
Creates a new matrix using the given double values.

Parameters:
a - the a component of the matrix
b - the b component of the matrix
c - the c component of the matrix
d - the d component of the matrix
e - the e component of the matrix
f - the f component of the matrix

Matrix

public Matrix(Matrix clone)
Creates a clone of the given matrix.

Parameters:
clone - the matrix to be cloned
Method Detail

add

public void add(double a,
                double b,
                double c,
                double d,
                double e,
                double f)
Adds the given matrix to this matrix.

Parameters:
a - the a component of the matrix
b - the b component of the matrix
c - the c component of the matrix
d - the d component of the matrix
e - the e component of the matrix
f - the f component of the matrix

get

public double get(int row,
                  int column)
Returns the element of the matrix at the given row and column.

Parameters:
row - the row of the element
column - the column of the element
Returns:
the element of the matrix at the given row and column

getMatrix

public double[][] getMatrix()
Returns the array of element data.

Returns:
the array of element data

identity

public void identity()
Sets this matrix to the identity matrix.


invert

public Matrix invert()
Returns the inverse of this matrix.

Returns:
the inverse of this matrix

pointMultiply

public PrecisePoint pointMultiply(PrecisePoint point)
Multiplies the matrix by the given point and returns the result.

Parameters:
point - the point to multiply
Returns:
the result of the multiplication

prepend

public void prepend(double a,
                    double b,
                    double c,
                    double d,
                    double e,
                    double f)
Prepend this matrix with the given matrix.

Parameters:
a - the a component of the matrix
b - the b component of the matrix
c - the c component of the matrix
d - the d component of the matrix
e - the e component of the matrix
f - the f component of the matrix

rotate

public void rotate(double angle,
                   double x,
                   double y)
Rotates the matrix using the given angle and arbitrary axis.

Parameters:
angle - the angle used to rotate the matrix
x - the x coordinate of the arbitrary axis
y - the y coordinate of the arbitrary axis

scale

public void scale(double x,
                  double y,
                  double cx,
                  double cy)
Scales the matrix using given x and y scale and the given origin

Parameters:
x - the x scale
y - the y scale
cx - the x-coordinate of the scale
cy - the y-coordinate of the scale

set

public void set(int row,
                int column,
                double value)
Sets an element of the matrix using the given value at the specified row and column.

Parameters:
row - the row of the element
column - the column of the element
value - the new value of the element

setMatrix

public void setMatrix(double[][] matrix)
Sets the element data of the matrix using the given array.

Parameters:
matrix - must be a 3x3 array

translate

public void translate(double x,
                      double y)
Translates the matrix using the given x and y values.

Parameters:
x - the translation on the x axis
y - the translation on the y axis


Copyright © 2011. All Rights Reserved.