Revision cc99cf91
Added by Leszek Koltunski over 3 years ago
src/main/java/org/distorted/objects/MovementCube.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.objects; |
21 | 21 |
|
22 |
import org.distorted.library.type.Static3D; |
|
23 |
|
|
22 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 | 25 |
|
24 | 26 |
class MovementCube extends Movement |
25 | 27 |
{ |
28 |
static final float DIST3D = 0.5f; |
|
29 |
static final float DIST2D = 0.5f; |
|
30 |
|
|
31 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
32 |
{ |
|
33 |
new Static3D(1,0,0), new Static3D(-1,0,0), |
|
34 |
new Static3D(0,1,0), new Static3D(0,-1,0), |
|
35 |
new Static3D(0,0,1), new Static3D(0,0,-1) |
|
36 |
}; |
|
37 |
|
|
38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
39 |
|
|
26 | 40 |
MovementCube() |
27 | 41 |
{ |
28 |
super(TwistyCube.ROT_AXIS, TwistyCube.FACE_AXIS, 0.5f, 0.5f);
|
|
42 |
super(TwistyCube.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
|
|
29 | 43 |
} |
30 | 44 |
|
31 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 46 |
|
33 |
boolean isInsideFace(float[] p) |
|
47 |
boolean isInsideFace(int face, float[] p)
|
|
34 | 48 |
{ |
35 |
return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
|
|
49 |
return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
|
|
36 | 50 |
} |
37 | 51 |
|
38 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Progress with the Diamond. Everything working, expect one thing: half of the faces are upside down, and computing offset doesn't work on those faces properly.