34 package eu.mihosoft.vrl.v3d;
36 import javax.vecmath.Matrix4d;
37 import javax.vecmath.Quat4d;
65 private final Matrix4d
m;
107 double radians = degrees * Math.PI * (1.0 / 180.0);
108 double cos = Math.cos(radians);
109 double sin = Math.sin(radians);
110 double elemenents[] = { 1, 0, 0, 0, 0, cos, sin, 0, 0, -sin, cos, 0, 0, 0, 0, 1 };
124 double radians = degrees * Math.PI * (1.0 / 180.0);
125 double cos = Math.cos(radians);
126 double sin = Math.sin(radians);
127 double elemenents[] = { cos, 0, -sin, 0, 0, 1, 0, 0, sin, 0, cos, 0, 0, 0, 0, 1 };
141 double radians = degrees * Math.PI * (1.0 / 180.0);
142 double cos = Math.cos(radians);
143 double sin = Math.sin(radians);
144 double elemenents[] = { cos, sin, 0, 0, -sin, cos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
204 double elemenents[] = { 1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1 };
218 double elemenents[] = { 1, 0, 0, value, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
226 Quat4d q1 =
new Quat4d();
234 Quat4d q1 =
new Quat4d();
242 Quat4d q1 =
new Quat4d();
250 Quat4d q1 =
new Quat4d();
258 javax.vecmath.Vector3d t1 =
new javax.vecmath.Vector3d();
264 javax.vecmath.Vector3d t1 =
new javax.vecmath.Vector3d();
270 javax.vecmath.Vector3d t1 =
new javax.vecmath.Vector3d();
282 javax.vecmath.Vector3d t1 =
new javax.vecmath.Vector3d();
284 Quat4d q1 =
new Quat4d();
287 return "X="+t1.x+
" Y="+t1.y+
" Z="+t1.z+
" Qx="+ q1.x+
" Qy="+q1.y+
" Qz="+q1.z+
" Qw="+q1.w;
300 double elemenents[] = { 1, 0, 0, 0, 0, 1, 0, value, 0, 0, 1, 0, 0, 0, 0, 1 };
314 double elemenents[] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, value, 0, 0, 0, 1 };
329 System.err.println(
"WARNING: I'm too dumb to implement the mirror() operation correctly. Please fix me!");
334 double w = plane.
dist;
335 double elemenents[] = { (1.0 - 2.0 * nx * nx), (-2.0 * ny * nx), (-2.0 * nz * nx), 0, (-2.0 * nx * ny),
336 (1.0 - 2.0 * ny * ny), (-2.0 * nz * ny), 0, (-2.0 * nx * nz), (-2.0 * ny * nz), (1.0 - 2.0 * nz * nz),
337 0, (-2.0 * nx * w), (-2.0 * ny * w), (-2.0 * nz * w), 1 };
352 if (vec.
x == 0 || vec.
y == 0 || vec.
z == 0) {
353 throw new IllegalArgumentException(
"scale by 0 not allowed!");
356 double elemenents[] = { vec.
x, 0, 0, 0, 0, vec.
y, 0, 0, 0, 0, vec.
z, 0, 0, 0, 0, 1 };
375 if (x == 0 || y == 0 || z == 0) {
376 throw new IllegalArgumentException(
"scale by 0 not allowed!");
379 double elemenents[] = { x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1 };
395 throw new IllegalArgumentException(
"scale by 0 not allowed!");
398 double elemenents[] = { s, 0, 0, 0, 0, s, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 };
414 throw new IllegalArgumentException(
"scale by 0 not allowed!");
417 double elemenents[] = { s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
433 throw new IllegalArgumentException(
"scale by 0 not allowed!");
436 double elemenents[] = { 1, 0, 0, 0, 0, s, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
452 throw new IllegalArgumentException(
"scale by 0 not allowed!");
455 double elemenents[] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, s, 0, 0, 0, 0, 1 };
494 double prevX = vec.
x;
495 double prevY = vec.
y;
496 double prevZ = vec.
z;
508 double diffX = vec.
x - prevX;
509 double diffY = vec.
y - prevY;
510 double diffZ = vec.
z - prevZ;
512 vec.
x = prevX + (diffX) * amount;
513 vec.
y = prevY + (diffY) * amount;
514 vec.
z = prevZ + (diffZ) * amount;
611 return new Transform().translate(x.doubleValue(),y.doubleValue(),z.doubleValue()).apply(
this);
617 return new Transform().translate(v.
x,v.
y,v.
z).apply(
this);
620 return move(posVector[0], posVector[1], posVector[2]);
632 return new Transform().translateY(howFarToMove.doubleValue()).apply(
this);
643 return new Transform().translateZ(howFarToMove.doubleValue()).apply(
this);
654 return new Transform().translateX(howFarToMove.doubleValue()).apply(
this);
695 return new Transform().rotZ(degreesToRotate.doubleValue()).apply(
this);
706 return new Transform().rotY(degreesToRotate.doubleValue()).apply(
this);
717 return new Transform().rotX(degreesToRotate.doubleValue()).apply(
this);
static Vector3d y(double y)
static Vector3d z(double z)
static Vector3d x(double x)