public class Matrix extends Object
Matrix class representing the vector transform matrix used in SVG
and VML
.
Many of SVG's graphics operations utilize 2x3 matrices of the form:
[a c e]
[b d f]
which, when expanded into a 3x3 matrix for the purposes of matrix arithmetic, become:
[a c e]
[b d f]
[0 0 1]
See Matrix for more information.
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public Matrix()
public Matrix(double a, double b, double c, double d, double e, double f)
a
- the a component of the matrixb
- the b component of the matrixc
- the c component of the matrixd
- the d component of the matrixe
- the e component of the matrixf
- the f component of the matrixpublic Matrix(Matrix clone)
clone
- the matrix to be clonedpublic void add(double a, double b, double c, double d, double e, double f)
a
- the a component of the matrixb
- the b component of the matrixc
- the c component of the matrixd
- the d component of the matrixe
- the e component of the matrixf
- the f component of the matrixpublic double get(int row, int column)
row
- the row of the elementcolumn
- the column of the elementpublic double[][] getMatrix()
public void identity()
public Matrix invert()
public PrecisePoint pointMultiply(PrecisePoint point)
point
- the point to multiplypublic void prepend(double a, double b, double c, double d, double e, double f)
a
- the a component of the matrixb
- the b component of the matrixc
- the c component of the matrixd
- the d component of the matrixe
- the e component of the matrixf
- the f component of the matrixpublic void rotate(double angle, double x, double y)
angle
- the angle used to rotate the matrixx
- the x coordinate of the arbitrary axisy
- the y coordinate of the arbitrary axispublic void scale(double x, double y, double cx, double cy)
x
- the x scaley
- the y scalecx
- the x-coordinate of the scalecy
- the y-coordinate of the scalepublic void set(int row, int column, double value)
row
- the row of the elementcolumn
- the column of the elementvalue
- the new value of the elementpublic void setMatrix(double[][] matrix)
matrix
- must be a 3x3 arraypublic void translate(double x, double y)
x
- the translation on the x axisy
- the translation on the y axisCopyright © 2018. All rights reserved.