Revision 0e5ad27c
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/objects/Cubit.java | ||
---|---|---|
120 | 120 |
quat.set(x,y,z,w); |
121 | 121 |
} |
122 | 122 |
|
123 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
124 |
|
|
125 |
private int computeNearestAngle(float angle) |
|
126 |
{ |
|
127 |
final int NEAREST = 360/mParent.getBasicAngle(); |
|
128 |
|
|
129 |
int tmp = (int)((angle+NEAREST/2)/NEAREST); |
|
130 |
if( angle< -(NEAREST*0.5) ) tmp-=1; |
|
131 |
|
|
132 |
return NEAREST*tmp; |
|
133 |
} |
|
134 |
|
|
135 | 123 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
136 | 124 |
|
137 | 125 |
private void modifyCurrentPosition(Static4D quat) |
... | ... | |
317 | 305 |
if( pointNum>=1 ) |
318 | 306 |
{ |
319 | 307 |
float startingAngle = mRotationAngle.getPoint(pointNum-1).get0(); |
320 |
int nearestAngleInDegrees = computeNearestAngle(startingAngle); |
|
308 |
int nearestAngleInDegrees = mParent.computeNearestAngle(startingAngle);
|
|
321 | 309 |
mParent.mRotationAngleStatic.set0(startingAngle); |
322 | 310 |
mParent.mRotationAngleFinal.set0(nearestAngleInDegrees); |
323 | 311 |
mParent.mRotationAngleMiddle.set0( nearestAngleInDegrees + (nearestAngleInDegrees-startingAngle)*0.2f ); |
... | ... | |
340 | 328 |
float axisZ = mParent.ROTATION_AXIS[axis].get2(); |
341 | 329 |
|
342 | 330 |
float startingAngle = mRotationAngle.getPoint(pointNum-1).get0(); |
343 |
int nearestAngleInDegrees = computeNearestAngle(startingAngle); |
|
331 |
int nearestAngleInDegrees = mParent.computeNearestAngle(startingAngle);
|
|
344 | 332 |
double nearestAngleInRadians = nearestAngleInDegrees*Math.PI/180; |
345 | 333 |
float sinA =-(float)Math.sin(nearestAngleInRadians*0.5); |
346 | 334 |
float cosA = (float)Math.cos(nearestAngleInRadians*0.5); |
Also available in: Unified diff
Add a 'withdraw move' button to the Solving UI state.