Revision 97d2f701
Added by Leszek Koltunski almost 5 years ago
src/main/java/org/distorted/object/RubikObject.java | ||
---|---|---|
131 | 131 |
final Static4D[] maps = new Static4D[numFaces]; |
132 | 132 |
final float ratio = 1.0f/(numFaces+1); |
133 | 133 |
|
134 |
if( 2*ROTATION_AXIS.length == numFaces ) |
|
134 |
if( 2*ROTATION_AXIS.length == numFaces ) // i.e. there are faces on both ends of the axis (cube)
|
|
135 | 135 |
{ |
136 | 136 |
for(int i=0; i<numFaces; i++) |
137 | 137 |
{ |
... | ... | |
139 | 139 |
maps[i] = new Static4D( (belongs?i:6)*ratio, 0.0f, ratio, 1.0f); |
140 | 140 |
} |
141 | 141 |
} |
142 |
else if( ROTATION_AXIS.length == numFaces ) |
|
142 |
else if( ROTATION_AXIS.length == numFaces ) // just a single face on the right end of an axis (pyraminx)
|
|
143 | 143 |
{ |
144 | 144 |
for(int i=0; i<numFaces; i++) |
145 | 145 |
{ |
... | ... | |
152 | 152 |
} |
153 | 153 |
|
154 | 154 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
155 |
// Cast centers of all Cubits on the first rotation Axis and compute the leftmost and rightmost |
|
156 |
// one. From there compute the 'start' (i.e. the leftmost) and 'step' (i.e. distance between two |
|
157 |
// consecutive). |
|
158 |
// it is assumed that other rotation axis have the same 'start' and 'step' - this is the case with |
|
159 |
// the Cube and the Pyraminx. |
|
160 |
// Start and Step are then needed to compute which rotation row (with respect to a given axis) a |
|
161 |
// given Cubit belongs to. |
|
155 | 162 |
|
156 | 163 |
private void computeStartAndStep(Static3D[] pos) |
157 | 164 |
{ |
src/main/java/org/distorted/object/RubikPyraminx.java | ||
---|---|---|
119 | 119 |
|
120 | 120 |
void createFaceTexture(Canvas canvas, Paint paint, int face) |
121 | 121 |
{ |
122 |
|
|
122 |
/* |
|
123 |
InputStream is = mView.getContext().getResources().openRawResource(R.raw.pyraminx); |
|
124 |
Bitmap bitmap; |
|
125 |
|
|
126 |
try |
|
127 |
{ |
|
128 |
bitmap = BitmapFactory.decodeStream(is); |
|
129 |
} |
|
130 |
finally |
|
131 |
{ |
|
132 |
try |
|
133 |
{ |
|
134 |
is.close(); |
|
135 |
} |
|
136 |
catch(IOException e) { } |
|
137 |
} |
|
138 |
|
|
139 |
paint.setColor(FACE_COLORS[face]); |
|
140 |
canvas.drawRect(face*TEXTURE_HEIGHT,0,(face+1)*TEXTURE_HEIGHT,TEXTURE_HEIGHT,paint); |
|
141 |
canvas.drawBitmap(bitmap,face*TEXTURE_HEIGHT,0,null); |
|
142 |
*/ |
|
123 | 143 |
} |
124 | 144 |
|
125 | 145 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Minor.