Revision 789769bd
Added by Leszek Koltunski 12 months ago
src/main/java/org/distorted/bandaged/BandagedCreatorTouchControl.java | ||
---|---|---|
26 | 26 |
private final int mNumFaces; |
27 | 27 |
|
28 | 28 |
private float[] mDist3D; |
29 |
private int mLastTouchedFace; |
|
30 | 29 |
|
31 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 | 31 |
// Convert the 3D point3D into a 2D point on the same face surface, but in a different |
... | ... | |
128 | 127 |
mCamera[1] = rotatedCamera.get1()/mObjectRatio; |
129 | 128 |
mCamera[2] = rotatedCamera.get2()/mObjectRatio; |
130 | 129 |
|
131 |
for( mLastTouchedFace=0; mLastTouchedFace<mNumFaces; mLastTouchedFace++)
|
|
130 |
for( int face=0; face<mNumFaces; face++)
|
|
132 | 131 |
{ |
133 |
if( faceIsVisible(mLastTouchedFace) )
|
|
132 |
if( faceIsVisible(face) )
|
|
134 | 133 |
{ |
135 |
castTouchPointOntoFace(mLastTouchedFace, mTouch);
|
|
134 |
castTouchPointOntoFace(face, mTouch);
|
|
136 | 135 |
|
137 |
float ax = mFaceAxis[mLastTouchedFace].get0();
|
|
138 |
float ay = mFaceAxis[mLastTouchedFace].get1();
|
|
139 |
float az = mFaceAxis[mLastTouchedFace].get2();
|
|
136 |
float ax = mFaceAxis[face].get0();
|
|
137 |
float ay = mFaceAxis[face].get1();
|
|
138 |
float az = mFaceAxis[face].get2();
|
|
140 | 139 |
|
141 | 140 |
convertTo2Dcoords(mTouch, ax,ay,az, mPoint2D); |
142 | 141 |
|
143 |
if( mObject.isInsideFace(mLastTouchedFace,mPoint2D) ) return true;
|
|
142 |
if( mObject.isInsideFace(face,mPoint2D) ) return true;
|
|
144 | 143 |
} |
145 | 144 |
} |
146 | 145 |
|
... | ... | |
197 | 196 |
|
198 | 197 |
if( !touched ) return -1; |
199 | 198 |
|
200 |
return mObject.whichCubitTouched(mLastTouchedFace,mPoint2D[0],mPoint2D[1]);
|
|
199 |
return mObject.whichCubitTouched(mTouch);
|
|
201 | 200 |
} |
202 | 201 |
} |
203 | 202 |
|
Also available in: Unified diff
Progress with BandagedObjectPyraminx.