public class CDSMatrix extends CDSBase
Each matrix is represented as an array.
The transformation matrix:
+ +
| a b 0 |
| c d 0 |
| e f 1 |
+ +
is written as a COSArray in the form:
[ a b c d e f ]
The identity transformation has the form:
[ 1 0 0 1 0 0 ]
Coordinates could be transformed by a matrix.
A coordinate transformation is defined as:
+ +
| a b 0 |
[ x' y' 1 ] = [ x y 1] * | c d 0 |
| e f 1 |
+ +
so that
x' = x*a + y*c + e
y' = x*b + y*d + f
COSBasedObject.MetaClass| Modifier and Type | Field and Description |
|---|---|
static float[] |
MATRIX_0
Static information needed for rotation: rotate 0 degress (identity
matrix)
|
static float[] |
MATRIX_180
Static information needed for rotation: rotate 180 degrees
|
static float[] |
MATRIX_270
Static information needed for rotation: rotate 270 degrees
|
static float[] |
MATRIX_90
Static information needed for rotation: rotate 90 degrees
|
META| Constructor and Description |
|---|
CDSMatrix()
CDSMatrix constructor.
|
CDSMatrix(float[] data)
Create a CDSMatrix based on the array in the parameter.
|
CDSMatrix(float a,
float b,
float c,
float d,
float e,
float f)
Create a CDSMatrix based on the values in the parameter.
|
| Modifier and Type | Method and Description |
|---|---|
CDSMatrix |
copy()
Create a copy of the receiver
|
static CDSMatrix |
createFromCOS(COSArray array)
Create a
CDSMatrix from an array holding the
transformation parameters. |
float |
getA()
Return the matrix element "a".
|
float |
getB()
Return the matrix element "b".
|
float |
getC()
Return the matrix element "c".
|
float |
getD()
Return the matrix element "d".
|
float |
getE()
Return the matrix element "e".
|
float |
getF()
Return the matrix element "f".
|
void |
invalidateCaches()
Invalidate all local caches as the base object may have changed.
|
void |
rotate(float angle)
Concatenate this transformation with a rotation transformation.
|
void |
scale(float[] v)
Concatenate this transformation with a scaling transformation.
|
void |
scale(float sx,
float sy)
Concatenate this transformation with a scaling transformation.
|
void |
setA(float num)
Set the matrix element "a".
|
void |
setB(float num)
Set the matrix element "b".
|
void |
setC(float num)
Set the matrix element "c".
|
void |
setD(float num)
Set the matrix element "d".
|
void |
setE(float num)
Set the matrix element "e".
|
void |
setF(float num)
Set the matrix element "f".
|
void |
setTransformation(AffineTransform transform)
Set all matrix elements "a" - "f"
|
void |
setTransformation(float[] data)
Set all matrix elements "a" - "f"
|
void |
setTransformation(float a,
float b,
float c,
float d,
float e,
float f)
Set all matrix elements "a" - "f"
|
AffineTransform |
toTransform()
Create an
AffineTransform that corresponds to this. |
float[] |
transform(float[] v)
Transform a vector
v using this. |
void |
translate(float[] v)
Concatenate this transformation with a translation transformation.
|
void |
translate(float x,
float y)
Concatenate this transformation with a translation transformation.
|
changed, cosGetArray, cosGetDict, cosGetDoc, cosGetField, cosGetObject, cosGetStream, cosHasField, cosRemoveField, cosSetField, getAttribute, getFieldBoolean, getFieldDate, getFieldFixed, getFieldFixedArray, getFieldInt, getFieldMLString, getFieldString, removeAttribute, setAttribute, setFieldBoolean, setFieldFixed, setFieldInt, setFieldMLString, setFieldName, setFieldObject, setFieldString, toStringpublic static float[] MATRIX_0
public static float[] MATRIX_90
public static float[] MATRIX_180
public static float[] MATRIX_270
public CDSMatrix()
Create a new identity matrix
public CDSMatrix(float a,
float b,
float c,
float d,
float e,
float f)
public CDSMatrix(float[] data)
data - The array defining the matrix.public static CDSMatrix createFromCOS(COSArray array)
CDSMatrix from an array holding the
transformation parameters.public CDSMatrix copy()
public float getA()
public float getB()
public float getC()
public float getD()
public float getE()
public float getF()
public void invalidateCaches()
COSBasedObjectinvalidateCaches in class COSBasedObjectpublic void rotate(float angle)
angle - Rotation angle in radianspublic void scale(float sx,
float sy)
sx - The scale factor in x directionsy - The scale factor in y directionpublic void scale(float[] v)
v - The scale factor.public void setA(float num)
num - The new matrix element "a".public void setB(float num)
num - The new matrix element "b".public void setC(float num)
num - The new matrix element "c".public void setD(float num)
num - The new matrix element "d".public void setE(float num)
num - The new matrix element "e".public void setF(float num)
num - The new matrix element "f".public void setTransformation(AffineTransform transform)
transform - The matrix defining the new parameterspublic void setTransformation(float a,
float b,
float c,
float d,
float e,
float f)
a - The new matrix element "a".b - The new matrix element "b".c - The new matrix element "c".d - The new matrix element "d".e - The new matrix element "e".f - The new matrix element "f".public void setTransformation(float[] data)
data - The array defining the new parameterspublic AffineTransform toTransform()
AffineTransform that corresponds to this.AffineTransform that corresponds to this.public float[] transform(float[] v)
v using this.v - The vector that will be transformed.public void translate(float x,
float y)
x - The translation in x directiony - The translation in y directionpublic void translate(float[] v)
v - The translation vectorCopyright © 2013 intarsys consulting GmbH. All Rights Reserved.