Revision ba422188
Added by Leszek Koltunski 10 months ago
| src/main/java/org/distorted/library/helpers/QuatHelper.java | ||
|---|---|---|
| 49 | 49 |
return new Static4D(tx,ty,tz,tw); |
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 53 |
// return quat1*quat2 |
|
| 54 |
|
|
| 55 |
public static void quatMultiply( float[] ret, Static4D quat1, Static4D quat2 ) |
|
| 56 |
{
|
|
| 57 |
float qx = quat1.get0(); |
|
| 58 |
float qy = quat1.get1(); |
|
| 59 |
float qz = quat1.get2(); |
|
| 60 |
float qw = quat1.get3(); |
|
| 61 |
|
|
| 62 |
float rx = quat2.get0(); |
|
| 63 |
float ry = quat2.get1(); |
|
| 64 |
float rz = quat2.get2(); |
|
| 65 |
float rw = quat2.get3(); |
|
| 66 |
|
|
| 67 |
ret[0] = rw*qx - rz*qy + ry*qz + rx*qw; |
|
| 68 |
ret[1] = rw*qy + rz*qx + ry*qw - rx*qz; |
|
| 69 |
ret[2] = rw*qz + rz*qw - ry*qx + rx*qy; |
|
| 70 |
ret[3] = rw*qw - rz*qz - ry*qy - rx*qx; |
|
| 71 |
} |
|
| 72 |
|
|
| 52 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 53 | 74 |
// return quat1*quat2 |
| 54 | 75 |
|
Also available in: Unified diff
progress with generic ghostAxis switching.