Revision cc99cf91
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/objects/Movement.java | ||
---|---|---|
38 | 38 |
|
39 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 40 |
|
41 |
abstract boolean isInsideFace(float[] point); |
|
41 |
abstract boolean isInsideFace(int face, float[] point);
|
|
42 | 42 |
abstract void computeEnabledAxis(int face, float[] touchPoint, int[] enabledAxis); |
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
60 | 60 |
mDistanceCenterFace3D = distance3D; // distance from the center of the object to each of its faces |
61 | 61 |
mDistanceCenterFace2D = distance2D; // distance from the center of a face to its edge |
62 | 62 |
|
63 |
// mCastedRotAxis[1][2]{0,1} are the 2D coords of the 2nd axis cast onto the face defined by the
|
|
64 |
// 1st pair (axis,lr)
|
|
63 |
// mCastedRotAxis[1][2]{0,1} are the 2D coords of the 2nd rotAxis cast onto the face defined by the
|
|
64 |
// 1st faceAxis.
|
|
65 | 65 |
mCastedRotAxis = new float[mNumFaceAxis][rotAxis.length][2]; |
66 | 66 |
mCastedRotAxis4D = new Static4D[mNumFaceAxis][rotAxis.length]; |
67 | 67 |
|
... | ... | |
155 | 155 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
156 | 156 |
// given precomputed mCamera and mPoint, respectively camera and touch point positions in ScreenSpace, |
157 | 157 |
// compute point 'output[]' which: |
158 |
// 1) lies on a face of the Object, i.e. surface defined by (axis, distance from (0,0,0)) [and this |
|
159 |
// distance is +-mDistanceCenterFace, depending if it is the face on the left or the right end of |
|
160 |
// the axis] (lr=0 or 1, so (2lr-1)*mDistanceCenterFace) |
|
158 |
// 1) lies on a face of the Object, i.e. surface defined by (axis, distance from (0,0,0)) |
|
161 | 159 |
// 2) is co-linear with mCamera and mPoint |
162 | 160 |
// |
163 | 161 |
// output = camera + alpha*(point-camera), where alpha = [dist-axis*camera] / [axis*(point-camera)] |
... | ... | |
256 | 254 |
{ |
257 | 255 |
castTouchPointOntoFace(mFaceAxis[mLastTouchedFace], mTouch); |
258 | 256 |
convertTo2Dcoords(mTouch, mFaceAxis[mLastTouchedFace], mPoint2D); |
259 |
if( isInsideFace(mPoint2D) ) return true; |
|
257 |
if( isInsideFace(mLastTouchedFace,mPoint2D) ) return true;
|
|
260 | 258 |
} |
261 | 259 |
} |
262 | 260 |
|
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 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/MovementDiamond.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 MovementDiamond extends Movement |
25 | 27 |
{ |
26 |
MovementDiamond() |
|
27 |
{ |
|
28 |
super(TwistyDiamond.ROT_AXIS, TwistyDiamond.FACE_AXIS, 0.25f, 0.25f); |
|
29 |
} |
|
28 |
private static final float SQ3 = (float)Math.sqrt(3); |
|
29 |
private static final float SQ6 = (float)Math.sqrt(6); |
|
30 |
|
|
31 |
static final float DIST3D = SQ6/6; |
|
32 |
static final float DIST2D = SQ3/6; |
|
33 |
|
|
34 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
35 |
{ |
|
36 |
new Static3D(+SQ6/3,+SQ3/3, 0), new Static3D(-SQ6/3,-SQ3/3, 0), |
|
37 |
new Static3D(-SQ6/3,+SQ3/3, 0), new Static3D(+SQ6/3,-SQ3/3, 0), |
|
38 |
new Static3D( 0,+SQ3/3,+SQ6/3), new Static3D( 0,-SQ3/3,-SQ6/3), |
|
39 |
new Static3D( 0,+SQ3/3,-SQ6/3), new Static3D( 0,-SQ3/3,+SQ6/3) |
|
40 |
}; |
|
30 | 41 |
|
31 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 |
// _____________ |
|
33 |
// | \ 0 / | |
|
34 |
// | \ / | |
|
35 |
// | 3 | | 1 | |
|
36 |
// | / \ | |
|
37 |
// | / 2 \ | |
|
38 |
// ------------- |
|
39 | 43 |
|
40 |
private int getQuarter(float[] touchPoint)
|
|
44 |
MovementDiamond()
|
|
41 | 45 |
{ |
42 |
boolean p0 = touchPoint[1] >= touchPoint[0]; |
|
43 |
boolean p1 = touchPoint[1] >=-touchPoint[0]; |
|
44 |
|
|
45 |
if( p0 ) return p1 ? 0:3; |
|
46 |
else return p1 ? 1:2; |
|
46 |
super(TwistyDiamond.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D); |
|
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 50 |
|
51 |
boolean isInsideFace(float[] p) |
|
51 |
boolean isInsideFace(int face, float[] p)
|
|
52 | 52 |
{ |
53 |
return ( p[0]<=0.25f && p[0]>=-0.25f && p[1]<=0.25f && p[1]>=-0.25f ); |
|
53 |
float y = (face%2 == 0 ? p[1] : -p[1]); |
|
54 |
float x = p[0]; |
|
55 |
|
|
56 |
return (y >= -DIST2D) && (y <= DIST2D*(2-6*x)) && (y <= DIST2D*(2+6*x)); |
|
54 | 57 |
} |
55 | 58 |
|
56 | 59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
57 | 60 |
|
58 | 61 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
59 | 62 |
{ |
60 |
enabled[0] = 2; |
|
61 |
|
|
62 |
int quarter = getQuarter(touchPoint); |
|
63 |
enabled[0] = 3; |
|
63 | 64 |
|
64 | 65 |
switch(face) |
65 | 66 |
{ |
66 |
case 0: switch(quarter) |
|
67 |
{ |
|
68 |
case 0: enabled[1]=0; enabled[2]=1; break; |
|
69 |
case 1: enabled[1]=3; enabled[2]=1; break; |
|
70 |
case 2: enabled[1]=2; enabled[2]=3; break; |
|
71 |
case 3: enabled[1]=0; enabled[2]=2; break; |
|
72 |
} |
|
73 |
break; |
|
74 |
case 1: switch(quarter) |
|
75 |
{ |
|
76 |
case 0: enabled[1]=2; enabled[2]=3; break; |
|
77 |
case 1: enabled[1]=3; enabled[2]=1; break; |
|
78 |
case 2: enabled[1]=0; enabled[2]=1; break; |
|
79 |
case 3: enabled[1]=0; enabled[2]=2; break; |
|
80 |
} |
|
81 |
break; |
|
82 |
case 2: switch(quarter) |
|
83 |
{ |
|
84 |
case 0: enabled[1]=1; enabled[2]=2; break; |
|
85 |
case 1: enabled[1]=0; enabled[2]=1; break; |
|
86 |
case 2: enabled[1]=0; enabled[2]=3; break; |
|
87 |
case 3: enabled[1]=2; enabled[2]=3; break; |
|
88 |
} |
|
67 |
case 0: |
|
68 |
case 1: enabled[1]=1; enabled[2]=2; enabled[3]=3; |
|
89 | 69 |
break; |
90 |
case 3: switch(quarter) |
|
91 |
{ |
|
92 |
case 0: enabled[1]=1; enabled[2]=2; break; |
|
93 |
case 1: enabled[1]=2; enabled[2]=3; break; |
|
94 |
case 2: enabled[1]=0; enabled[2]=3; break; |
|
95 |
case 3: enabled[1]=0; enabled[2]=1; break; |
|
96 |
} |
|
70 |
case 2: |
|
71 |
case 3: enabled[1]=0; enabled[2]=2; enabled[3]=3; |
|
97 | 72 |
break; |
98 |
case 4: switch(quarter) |
|
99 |
{ |
|
100 |
case 0: enabled[1]=0; enabled[2]=3; break; |
|
101 |
case 1: enabled[1]=0; enabled[2]=2; break; |
|
102 |
case 2: enabled[1]=1; enabled[2]=2; break; |
|
103 |
case 3: enabled[1]=1; enabled[2]=3; break; |
|
104 |
} |
|
73 |
case 4: |
|
74 |
case 5: enabled[1]=0; enabled[2]=1; enabled[3]=3; |
|
105 | 75 |
break; |
106 |
case 5: switch(quarter) |
|
107 |
{ |
|
108 |
case 0: enabled[1]=1; enabled[2]=2; break; |
|
109 |
case 1: enabled[1]=0; enabled[2]=2; break; |
|
110 |
case 2: enabled[1]=0; enabled[2]=3; break; |
|
111 |
case 3: enabled[1]=1; enabled[2]=3; break; |
|
112 |
} |
|
76 |
case 6: |
|
77 |
case 7: enabled[1]=0; enabled[2]=1; enabled[3]=2; |
|
113 | 78 |
break; |
114 | 79 |
} |
115 | 80 |
} |
src/main/java/org/distorted/objects/MovementDino.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 MovementDino 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 |
MovementDino() |
27 | 41 |
{ |
28 |
super(TwistyDino.ROT_AXIS, TwistyDino.FACE_AXIS, 0.5f, 0.5f);
|
|
42 |
super(TwistyDino.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
|
|
29 | 43 |
} |
30 | 44 |
|
31 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
48 | 62 |
|
49 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 64 |
|
51 |
boolean isInsideFace(float[] p) |
|
65 |
boolean isInsideFace(int face, float[] p)
|
|
52 | 66 |
{ |
53 |
return ( p[0]<=0.5f && p[0]>=-0.5f && p[1]<=0.5f && p[1]>=-0.5f );
|
|
67 |
return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
|
|
54 | 68 |
} |
55 | 69 |
|
56 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/MovementHelicopter.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 MovementHelicopter extends Movement |
25 | 27 |
{ |
28 |
static final float DIST3D = 1.0f/6; |
|
29 |
static final float DIST2D = 1.0f/6; |
|
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 |
MovementHelicopter() |
27 | 41 |
{ |
28 |
super(TwistyHelicopter.ROT_AXIS, TwistyHelicopter.FACE_AXIS, 0.166f, 0.166f);
|
|
42 |
super(TwistyHelicopter.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
|
|
29 | 43 |
} |
30 | 44 |
|
31 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
48 | 62 |
|
49 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 64 |
|
51 |
boolean isInsideFace(float[] p) |
|
65 |
boolean isInsideFace(int face, float[] p)
|
|
52 | 66 |
{ |
53 |
return ( p[0]<=0.166f && p[0]>=-0.166f && p[1]<=0.166f && p[1]>=-0.166f );
|
|
67 |
return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
|
|
54 | 68 |
} |
55 | 69 |
|
56 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/MovementPyraminx.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 MovementPyraminx extends Movement |
25 | 27 |
{ |
26 |
private static final float SQ6 = (float)Math.sqrt(6);
|
|
28 |
private static final float SQ2 = (float)Math.sqrt(2);
|
|
27 | 29 |
private static final float SQ3 = (float)Math.sqrt(3); |
30 |
private static final float SQ6 = (float)Math.sqrt(6); |
|
31 |
|
|
32 |
static final float DIST3D = SQ6/12; |
|
33 |
static final float DIST2D = SQ3/6; |
|
34 |
|
|
35 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
36 |
{ |
|
37 |
new Static3D( 0, -1, 0 ), |
|
38 |
new Static3D( 0, 1.0f/3,-2*SQ2/3 ), |
|
39 |
new Static3D( SQ6/3, 1.0f/3, SQ2/3 ), |
|
40 |
new Static3D(-SQ6/3, 1.0f/3, SQ2/3 ) |
|
41 |
}; |
|
28 | 42 |
|
29 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 | 44 |
|
31 | 45 |
MovementPyraminx() |
32 | 46 |
{ |
33 |
super(TwistyPyraminx.ROT_AXIS, TwistyPyraminx.FACE_AXIS, SQ6/12, SQ3/6);
|
|
47 |
super(TwistyPyraminx.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
|
|
34 | 48 |
} |
35 | 49 |
|
36 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 51 |
|
38 |
boolean isInsideFace(float[] p) |
|
52 |
boolean isInsideFace(int face, float[] p)
|
|
39 | 53 |
{ |
40 |
boolean a1 = p[1] >= -SQ3/6; |
|
41 |
boolean a2 = p[1] <= SQ3*(1.0f/3 + p[0]); |
|
42 |
boolean a3 = p[1] <= SQ3*(1.0f/3 - p[0]); |
|
43 |
|
|
44 |
return a1 && a2 && a3; |
|
54 |
return (p[1] >= -DIST2D) && (p[1] <= DIST2D*(2+6*p[0])) && (p[1] <= DIST2D*(2-6*p[0])); |
|
45 | 55 |
} |
46 | 56 |
|
47 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/MovementSkewb.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 MovementSkewb extends Movement |
25 | 27 |
{ |
28 |
static final float DIST3D = 0.25f; |
|
29 |
static final float DIST2D = 0.25f; |
|
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 |
MovementSkewb() |
27 | 41 |
{ |
28 |
super(TwistySkewb.ROT_AXIS, TwistySkewb.FACE_AXIS, 0.25f, 0.25f);
|
|
42 |
super(TwistySkewb.ROT_AXIS, FACE_AXIS, DIST3D, DIST2D);
|
|
29 | 43 |
} |
30 | 44 |
|
31 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
48 | 62 |
|
49 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
50 | 64 |
|
51 |
boolean isInsideFace(float[] p) |
|
65 |
boolean isInsideFace(int face, float[] p)
|
|
52 | 66 |
{ |
53 |
return ( p[0]<=0.25f && p[0]>=-0.25f && p[1]<=0.25f && p[1]>=-0.25f );
|
|
67 |
return ( p[0]<=DIST2D && p[0]>=-DIST2D && p[1]<=DIST2D && p[1]>=-DIST2D );
|
|
54 | 68 |
} |
55 | 69 |
|
56 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/TwistyCube.java | ||
---|---|---|
55 | 55 |
new Static3D(0,0,1) |
56 | 56 |
}; |
57 | 57 |
|
58 |
// the six axis that determine the faces |
|
59 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
60 |
{ |
|
61 |
new Static3D(1,0,0), new Static3D(-1,0,0), |
|
62 |
new Static3D(0,1,0), new Static3D(0,-1,0), |
|
63 |
new Static3D(0,0,1), new Static3D(0,0,-1) |
|
64 |
}; |
|
65 |
|
|
66 | 58 |
private static final int[] FACE_COLORS = new int[] |
67 | 59 |
{ |
68 | 60 |
COLOR_YELLOW, COLOR_WHITE, |
src/main/java/org/distorted/objects/TwistyDiamond.java | ||
---|---|---|
58 | 58 |
{ |
59 | 59 |
new Static3D(+SQ6/3,+SQ3/3, 0), |
60 | 60 |
new Static3D(-SQ6/3,+SQ3/3, 0), |
61 |
new Static3D( 0,+SQ3/3,+SQ6/3), |
|
62 |
new Static3D( 0,+SQ3/3,-SQ6/3) |
|
63 |
}; |
|
64 |
|
|
65 |
// the eight axis that determine the faces |
|
66 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
67 |
{ |
|
68 |
new Static3D(+SQ6/3,+SQ3/3, 0), new Static3D(-SQ6/3,-SQ3/3, 0), |
|
69 |
new Static3D(-SQ6/3,+SQ3/3, 0), new Static3D(+SQ6/3,-SQ3/3, 0), |
|
70 |
new Static3D( 0,+SQ3/3,+SQ6/3), new Static3D( 0,-SQ3/3,-SQ6/3), |
|
71 |
new Static3D( 0,+SQ3/3,-SQ6/3), new Static3D( 0,-SQ3/3,+SQ6/3) |
|
61 |
new Static3D( 0,-SQ3/3,-SQ6/3), |
|
62 |
new Static3D( 0,-SQ3/3,+SQ6/3) |
|
72 | 63 |
}; |
73 | 64 |
|
74 | 65 |
private static final int[] FACE_COLORS = new int[] |
... | ... | |
537 | 528 |
|
538 | 529 |
float returnMultiplier() |
539 | 530 |
{ |
540 |
return 2.0f;
|
|
531 |
return 1.5f;
|
|
541 | 532 |
} |
542 | 533 |
|
543 | 534 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
571 | 562 |
|
572 | 563 |
public int computeRowFromOffset(float offset) |
573 | 564 |
{ |
574 |
return offset<0.25f ? 0:1;
|
|
565 |
return offset<SQ3/12 ? 0:1;
|
|
575 | 566 |
} |
576 | 567 |
|
577 | 568 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objects/TwistyDino.java | ||
---|---|---|
59 | 59 |
new Static3D(+SQ3/3,-SQ3/3,-SQ3/3) |
60 | 60 |
}; |
61 | 61 |
|
62 |
// the six axis that determine the faces |
|
63 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
64 |
{ |
|
65 |
new Static3D(1,0,0), new Static3D(-1,0,0), |
|
66 |
new Static3D(0,1,0), new Static3D(0,-1,0), |
|
67 |
new Static3D(0,0,1), new Static3D(0,0,-1) |
|
68 |
}; |
|
69 |
|
|
70 | 62 |
private static final int[] FACE_COLORS = new int[] |
71 | 63 |
{ |
72 | 64 |
COLOR_YELLOW, COLOR_WHITE, |
src/main/java/org/distorted/objects/TwistyHelicopter.java | ||
---|---|---|
64 | 64 |
new Static3D(-SQ2/2, -SQ2/2, 0) |
65 | 65 |
}; |
66 | 66 |
|
67 |
// the six axis that determine the faces |
|
68 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
69 |
{ |
|
70 |
new Static3D(1,0,0), new Static3D(-1,0,0), |
|
71 |
new Static3D(0,1,0), new Static3D(0,-1,0), |
|
72 |
new Static3D(0,0,1), new Static3D(0,0,-1) |
|
73 |
}; |
|
74 |
|
|
75 | 67 |
private static final int[] FACE_COLORS = new int[] |
76 | 68 |
{ |
77 | 69 |
COLOR_YELLOW, COLOR_WHITE, |
src/main/java/org/distorted/objects/TwistyPyraminx.java | ||
---|---|---|
58 | 58 |
new Static3D( SQ2*SQ3/3, -1.0f/3, -SQ2/3 ) |
59 | 59 |
}; |
60 | 60 |
|
61 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
62 |
{ |
|
63 |
new Static3D( 0, -1, 0 ), |
|
64 |
new Static3D( 0, 1.0f/3,-2*SQ2/3 ), |
|
65 |
new Static3D( SQ2*SQ3/3, 1.0f/3, SQ2/3 ), |
|
66 |
new Static3D(-SQ2*SQ3/3, 1.0f/3, SQ2/3 ) |
|
67 |
}; |
|
68 |
|
|
69 | 61 |
private static final int[] FACE_COLORS = new int[] |
70 | 62 |
{ |
71 | 63 |
COLOR_GREEN , COLOR_YELLOW, |
src/main/java/org/distorted/objects/TwistySkewb.java | ||
---|---|---|
62 | 62 |
new Static3D(+SQ3/3,-SQ3/3,-SQ3/3) |
63 | 63 |
}; |
64 | 64 |
|
65 |
// the six axis that determine the faces |
|
66 |
static final Static3D[] FACE_AXIS = new Static3D[] |
|
67 |
{ |
|
68 |
new Static3D(1,0,0), new Static3D(-1,0,0), |
|
69 |
new Static3D(0,1,0), new Static3D(0,-1,0), |
|
70 |
new Static3D(0,0,1), new Static3D(0,0,-1) |
|
71 |
}; |
|
72 |
|
|
73 | 65 |
private static final int[] FACE_COLORS = new int[] |
74 | 66 |
{ |
75 | 67 |
COLOR_YELLOW, COLOR_WHITE, |
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.