Revision cad4b4d6
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/object/RubikObjectMovement.java | ||
---|---|---|
114 | 114 |
|
115 | 115 |
private void convertTo2Dcoords(float[] point3D, Static3D axis, int lr, float[] output) |
116 | 116 |
{ |
117 |
float y0,y1,y2, x0,x1,x2; // base X and Y vectors of the 2D coord system
|
|
117 |
float y0,y1,y2; // base Y vector of the 2D coord system
|
|
118 | 118 |
float a0 = axis.get0(); |
119 | 119 |
float a1 = axis.get1(); |
120 | 120 |
float a2 = axis.get2(); |
... | ... | |
138 | 138 |
y0 = norm*a0; y1= norm*(a1-1/a1); y2=norm*a2; |
139 | 139 |
} |
140 | 140 |
|
141 |
x0 = y1*a2 - y2*a1; // |
|
142 |
x1 = y2*a0 - y0*a2; // (2D coord baseY) x (axis) = 2D coord baseX |
|
143 |
x2 = y0*a1 - y1*a0; // |
|
141 |
float x0 = y1*a2 - y2*a1; //
|
|
142 |
float x1 = y2*a0 - y0*a2; // (2D coord baseY) x (axis) = 2D coord baseX
|
|
143 |
float x2 = y0*a1 - y1*a0; //
|
|
144 | 144 |
|
145 | 145 |
float originAlpha = point3D[0]*a0 + point3D[1]*a1 + point3D[2]*a2; |
146 | 146 |
|
src/main/java/org/distorted/object/RubikPyraminxMovement.java | ||
---|---|---|
55 | 55 |
boolean isInsideFace(float[] p) |
56 | 56 |
{ |
57 | 57 |
boolean a1 = p[1] >= -SQ3/6; |
58 |
boolean a2 = p[1]*SQ3 <= 1 + 2*p[0];
|
|
59 |
boolean a3 = p[1]*SQ3 <= 1 - 2*p[0];
|
|
58 |
boolean a2 = p[1] <= SQ3*(1.0f/3 + p[0]);
|
|
59 |
boolean a3 = p[1] <= SQ3*(1.0f/3 - p[0]);
|
|
60 | 60 |
|
61 | 61 |
return a1 && a2 && a3; |
62 | 62 |
} |
Also available in: Unified diff
Progress with object Movement. Looks like detecting which face got touched and where (in 2D in-face surface coordinates) does work now.