1 package com.neuronrobotics.bowlerstudio.physics;
3 import javax.vecmath.Matrix4d;
4 import javax.vecmath.Quat4d;
5 import javax.vecmath.Quat4f;
6 import javax.vecmath.Vector3d;
8 import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR;
9 import com.neuronrobotics.sdk.addons.kinematics.math.TransformNR;
11 import javafx.application.Platform;
12 import javafx.scene.transform.Affine;
19 @SuppressWarnings(
"restriction")
30 public static Affine
newAffine(
double x,
double y,
double z){
41 Affine rotations =
new Affine();
42 return nrToAffine( input , rotations);
53 return affineToNr( rotations,input );
63 double[][] poseRot = outputValue
66 poseRot[0][0]=rotations.getMxx();
67 poseRot[0][1]=rotations.getMxy();
68 poseRot[0][2]=rotations.getMxz();
69 poseRot[1][0]=rotations.getMyx();
70 poseRot[1][1]=rotations.getMyy();
71 poseRot[1][2]=rotations.getMyz();
72 poseRot[2][0]=rotations.getMzx();
73 poseRot[2][1]=rotations.getMzy();
74 poseRot[2][2]=rotations.getMzz();
76 outputValue.
set(rotations.getTx(),rotations.getTy(),rotations.getTz(),poseRot);
88 if (!Platform.isFxApplicationThread()) {
89 new RuntimeException(
"This method must be in UI thread!").printStackTrace();
94 rotations=
new Affine();
95 double[][] poseRot = input
98 rotations.setMxx(poseRot[0][0]);
99 rotations.setMxy(poseRot[0][1]);
100 rotations.setMxz(poseRot[0][2]);
101 rotations.setMyx(poseRot[1][0]);
102 rotations.setMyy(poseRot[1][1]);
103 rotations.setMyz(poseRot[1][2]);
104 rotations.setMzx(poseRot[2][0]);
105 rotations.setMzy(poseRot[2][1]);
106 rotations.setMzz(poseRot[2][2]);
107 rotations.setTx(input.
getX());
108 rotations.setTy(input.
getY());
109 rotations.setTz(input.
getZ());
110 }
catch(Exception e) {
116 bullet.origin.set((
float) nr.
getX(), (
float) nr.
getY(), (
float) nr.
getZ());
124 Quat4f out =
new Quat4f();
125 bullet.getRotation(out);
126 return new TransformNR(bullet.origin.x, bullet.origin.y, bullet.origin.z, out.w, out.x, out.y, out.z);
129 public static void bulletToAffine(Affine affine, com.bulletphysics.linearmath.Transform bullet) {
130 if (!Platform.isFxApplicationThread()) {
131 new RuntimeException(
"This method must be in UI thread!").printStackTrace();
134 double[][] vals = bulletToNr(bullet).getRotationMatrix().getRotationMatrix();
139 affine.setMxx(vals[0][0]);
140 affine.setMxy(vals[0][1]);
141 affine.setMxz(vals[0][2]);
142 affine.setMyx(vals[1][0]);
143 affine.setMyy(vals[1][1]);
144 affine.setMyz(vals[1][2]);
145 affine.setMzx(vals[2][0]);
146 affine.setMzy(vals[2][1]);
147 affine.setMzz(vals[2][2]);
149 affine.setTx(bullet.origin.x);
150 affine.setTy(bullet.origin.y);
151 affine.setTz(bullet.origin.z);
154 public static void affineToBullet(Affine affine, com.bulletphysics.linearmath.Transform bullet) {
156 nrToBullet(nr, bullet);
160 Quat4d q1 =
new Quat4d();
165 Vector3d t1 =
new Vector3d();
171 Matrix4d rotation =
new Matrix4d(q1, t1, s);
172 return new eu.mihosoft.vrl.v3d.Transform(rotation);
183 Matrix4d rotation = csg.getInternalMatrix();
184 Quat4d q1 =
new Quat4d();
186 Vector3d t1 =
new Vector3d();
double getRotationElevation()
double getRotationAzimuth()
double getRotationMatrix2QuaturnionZ()
double getRotationMatrix2QuaturnionY()
double getRotationMatrix2QuaturnionX()
double getRotationMatrix2QuaturnionW()