1 package de.lathanda.eos.base.math;
3 import java.awt.geom.AffineTransform;
67 public Matrix(
double rotationAngle) {
68 x11 = Math.cos(rotationAngle);
69 x12 = -Math.sin(rotationAngle);
70 x21 = Math.sin(rotationAngle);
71 x22 = Math.cos(rotationAngle);
87 tx = translation.
getdx();
88 ty = translation.
getdy();
98 public Matrix(
double sx,
double sy) {
117 public Matrix(
double xt,
double yt,
double a,
double sx,
double sy) {
118 double c = Math.cos(a);
119 double s = Math.sin(a);
134 return new AffineTransform(x11, x21, x12, x22, tx, ty);
144 double xa = v.
getdx();
145 double ya = v.
getdy();
146 double xb = xa * x11 + ya * x12 + tx;
147 double yb = xa * x21 + ya * x22 + ty;
148 return new Vector(xb, yb);
158 double xa = p.
getX();
159 double ya = p.
getY();
160 double xb = xa * x11 + ya * x12 + tx;
161 double yb = xa * x21 + ya * x22 + ty;
162 return new Point(xb, yb);
173 public void transform(
double[] x,
double[] y,
double[] xt,
double[] yt) {
174 for (
int i = 0; i < x.length; i++) {
175 xt[i] = x[i] * x11 + y[i] * x12 + tx;
176 yt[i] = x[i] * x21 + y[i] * x22 + ty;
188 u.x11 = x11 * N.x11 + x12 * N.x21;
189 u.x12 = x11 * N.x12 + x12 * N.x22;
190 u.x21 = x21 * N.x21 + x12 * N.x21;
191 u.x22 = x21 * N.x12 + x22 * N.x22;
192 u.tx = x11 * N.tx + x12 * N.ty + tx;
193 u.ty = x21 * N.tx + x22 * N.ty + ty;
203 return new double[]{x11, x12, tx, x21, x22, ty, 0d, 0d, 1d};
Matrix(double sx, double sy)
Matrix(double rotationAngle)
Matrix(double xt, double yt, double a, double sx, double sy)
Vector transform(Vector v)
Matrix(Vector translation)
Matrix transform(Matrix N)
void transform(double[] x, double[] y, double[] xt, double[] yt)
AffineTransform convert()