Revision 10a2e360
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/object/Cubit.java | ||
---|---|---|
52 | 52 |
DistortedNode mNode; |
53 | 53 |
DistortedEffects mEffect; |
54 | 54 |
Static4D mQuatScramble; |
55 |
int[] mRotationRow; |
|
55 | 56 |
|
56 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
57 | 58 |
// Because of quatMultiplication, errors can accumulate - so to avoid this, we |
... | ... | |
149 | 150 |
int roundedZ = (int)(rotatedZ+0.1f); |
150 | 151 |
|
151 | 152 |
currentPosition.set(roundedX, roundedY, roundedZ); |
153 |
computeRotationRow(); |
|
154 |
} |
|
155 |
|
|
156 |
|
|
157 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
158 |
// TODO: this is only right in case of RubikCube |
|
159 |
|
|
160 |
private void computeRotationRow() |
|
161 |
{ |
|
162 |
mRotationRow[0] = (int)mCurrentPosition.get0(); |
|
163 |
mRotationRow[1] = (int)mCurrentPosition.get1(); |
|
164 |
mRotationRow[2] = (int)mCurrentPosition.get2(); |
|
152 | 165 |
} |
153 | 166 |
|
154 | 167 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
171 | 184 |
mCurrentPosition = position; |
172 | 185 |
mRotateEffect = new MatrixEffectRotate(mRotationAngle, mRotationAxis, matrCenter); |
173 | 186 |
|
187 |
mRotationRow = new int[mParent.ROTATION_AXIS.length]; |
|
188 |
computeRotationRow(); |
|
189 |
|
|
174 | 190 |
mEffect = new DistortedEffects(); |
175 | 191 |
mEffect.apply(mParent.mSinkEffect); |
176 | 192 |
mEffect.apply( new MatrixEffectMove(vector) ); |
Also available in: Unified diff
Progress towards generalizing belongsToRotation()