Revision be7c9190
Added by Leszek Koltunski over 2 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 |
|
|
24 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
25 | 23 |
|
26 |
class MovementCube extends Movement |
|
24 |
class MovementCube extends Movement6
|
|
27 | 25 |
{ |
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 |
|
|
40 | 26 |
MovementCube() |
41 | 27 |
{ |
42 |
super(TwistyCube.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
|
|
28 |
super(TwistyCube.ROT_AXIS); |
|
43 | 29 |
} |
44 | 30 |
|
45 | 31 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
49 | 35 |
return (int)(numLayers*offset); |
50 | 36 |
} |
51 | 37 |
|
52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
53 |
|
|
54 |
public float returnRotationFactor(int numLayers, int row) |
|
55 |
{ |
|
56 |
return 1.0f; |
|
57 |
} |
|
58 |
|
|
59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
60 |
|
|
61 |
boolean isInsideFace(int face, float[] p) |
|
62 |
{ |
|
63 |
return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D ); |
|
64 |
} |
|
65 |
|
|
66 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
67 | 39 |
|
68 | 40 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
Also available in: Unified diff
Abstract out some methods from the Movement classes. only two remain now: rowFromOffset and enabledAxis.