Revision b695a86a
Added by Leszek Koltunski about 9 years ago
| src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java | ||
|---|---|---|
| 50 | 50 |
|
| 51 | 51 |
private GLSurfaceView mView; |
| 52 | 52 |
private DistortedCubes mCube; |
| 53 |
private Random mRnd = new Random(System.currentTimeMillis()); |
|
| 53 |
|
|
| 54 | 54 |
private DynamicQuat mRot; |
| 55 | 55 |
|
| 56 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 57 | 57 |
|
| 58 |
public QuaternionRenderer(GLSurfaceView v)
|
|
| 58 |
QuaternionRenderer(GLSurfaceView v)
|
|
| 59 | 59 |
{
|
| 60 | 60 |
mView = v; |
| 61 | 61 |
mCube = new DistortedCubes( 3, "000010000", SIZE); |
| 62 | 62 |
|
| 63 | 63 |
mRot = new DynamicQuat(); |
| 64 |
|
|
| 64 |
|
|
| 65 |
Random rnd = new Random(System.currentTimeMillis()); |
|
| 65 | 66 |
float x,y,z,w, len; |
| 66 | 67 |
|
| 67 | 68 |
for(int i=0; i<NUM_QUATERNIONS; i++) |
| 68 | 69 |
{
|
| 69 |
x = 2*mRnd.nextFloat()-1;
|
|
| 70 |
y = 2*mRnd.nextFloat()-1;
|
|
| 71 |
z = 2*mRnd.nextFloat()-1;
|
|
| 72 |
w = 2*mRnd.nextFloat()-1;
|
|
| 70 |
x = 2*rnd.nextFloat()-1;
|
|
| 71 |
y = 2*rnd.nextFloat()-1;
|
|
| 72 |
z = 2*rnd.nextFloat()-1;
|
|
| 73 |
w = 2*rnd.nextFloat()-1;
|
|
| 73 | 74 |
|
| 74 | 75 |
len = (float)Math.sqrt( x*x+y*y+z*z+w*w ); |
| 75 | 76 |
|
Also available in: Unified diff
Tidy up 'Quaternion'