Revision efef689c
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/object/Cubit.java | ||
---|---|---|
231 | 231 |
|
232 | 232 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
233 | 233 |
|
234 |
Static4D returnRotationQuat( Static3D axis)
|
|
234 |
Static4D returnRotationQuat(int axis)
|
|
235 | 235 |
{ |
236 | 236 |
int pointNum = mRotationAngle.getNumPoints(); |
237 | 237 |
|
238 | 238 |
if( pointNum>=1 ) |
239 | 239 |
{ |
240 |
float axisX = mParent.ROTATION_AXIS[axis].get0(); |
|
241 |
float axisY = mParent.ROTATION_AXIS[axis].get1(); |
|
242 |
float axisZ = mParent.ROTATION_AXIS[axis].get2(); |
|
243 |
|
|
240 | 244 |
float startingAngle = mRotationAngle.getPoint(pointNum-1).get0(); |
241 | 245 |
int nearestAngleInDegrees = computeNearestAngle(startingAngle); |
242 | 246 |
double nearestAngleInRadians = nearestAngleInDegrees*Math.PI/180; |
243 | 247 |
float sinA =-(float)Math.sin(nearestAngleInRadians*0.5); |
244 | 248 |
float cosA = (float)Math.cos(nearestAngleInRadians*0.5); |
245 |
return new Static4D( axis.get0()*sinA, axis.get1()*sinA, axis.get2()*sinA, cosA);
|
|
249 |
return new Static4D( axisX*sinA, axisY*sinA, axisZ*sinA, cosA);
|
|
246 | 250 |
} |
247 | 251 |
|
248 | 252 |
return null; |
... | ... | |
279 | 283 |
|
280 | 284 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
281 | 285 |
|
282 |
void beginNewRotation(Static3D axis)
|
|
286 |
void beginNewRotation(int axis)
|
|
283 | 287 |
{ |
284 |
mRotationAxis.set(axis);
|
|
288 |
mRotationAxis.set( mParent.ROTATION_AXIS[axis] );
|
|
285 | 289 |
mRotationAngle.add(mParent.mRotationAngleStatic); |
286 | 290 |
} |
287 | 291 |
|
288 | 292 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
289 | 293 |
|
290 |
void addNewRotation(Static3D axis, long durationMillis, int angle)
|
|
294 |
void addNewRotation(int axis, long durationMillis, int angle)
|
|
291 | 295 |
{ |
292 |
mRotationAxis.set(axis);
|
|
296 |
mRotationAxis.set( mParent.ROTATION_AXIS[axis] );
|
|
293 | 297 |
mRotationAngle.setDuration(durationMillis); |
294 | 298 |
mRotationAngle.resetToBeginning(); |
295 | 299 |
mRotationAngle.add(new Static1D(0)); |
Also available in: Unified diff
Progress towards generalizing belongsToRotation()