Revision b480f4dd
Added by Leszek Koltunski about 1 year ago
src/main/java/org/distorted/objectlib/objects/TwistyCoinTetrahedron.java | ||
---|---|---|
12 | 12 |
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_TETRAHEDRON; |
13 | 13 |
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_EDGE_COIN; |
14 | 14 |
|
15 |
import org.distorted.library.main.QuatHelper; |
|
15 | 16 |
import org.distorted.library.type.Static3D; |
16 | 17 |
import org.distorted.library.type.Static4D; |
17 | 18 |
import org.distorted.objectlib.helpers.FactoryCubit; |
... | ... | |
39 | 40 |
new Static3D(-SQ6/3, SQ3/3, 0), |
40 | 41 |
}; |
41 | 42 |
|
43 |
private static final int N = 5; |
|
44 |
private static final float D = 0.9f; |
|
45 |
|
|
42 | 46 |
private int[][] mEdges; |
43 | 47 |
private int[][] mBasicAngle; |
44 | 48 |
private float[][] mCuts; |
45 | 49 |
private float[][] mPosition; |
50 |
private int[] mQuatIndex; |
|
51 |
|
|
52 |
private float[][] V,M,L; |
|
46 | 53 |
|
47 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 55 |
|
... | ... | |
121 | 128 |
return TouchControlTetrahedron.FACE_AXIS; |
122 | 129 |
} |
123 | 130 |
|
131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
132 |
|
|
133 |
private void initVertices() |
|
134 |
{ |
|
135 |
V = new float[][] |
|
136 |
{ |
|
137 |
{ 0.0f,-0.75f*SQ2,-1.5f}, |
|
138 |
{ 0.0f,-0.75f*SQ2, 1.5f}, |
|
139 |
{ 1.5f, 0.75f*SQ2, 0.0f}, |
|
140 |
{-1.5f, 0.75f*SQ2, 0.0f}, |
|
141 |
}; |
|
142 |
|
|
143 |
float A = 1.04f; |
|
144 |
M = new float[4][3]; |
|
145 |
|
|
146 |
for(int i=0; i<4; i++) |
|
147 |
for(int j=0; j<3; j++) |
|
148 |
M[i][j] = A*(V[0][j]+V[1][j]+V[2][j]+V[3][j]-V[i][j])/3; |
|
149 |
|
|
150 |
L = new float[12][3]; |
|
151 |
|
|
152 |
for(int i=0; i<3; i++) |
|
153 |
{ |
|
154 |
L[ 0][i] = 0.5f*V[1][i] + 0.25f*V[2][i] + 0.25f*V[3][i]; |
|
155 |
L[ 1][i] = 0.5f*V[3][i] + 0.25f*V[1][i] + 0.25f*V[2][i]; |
|
156 |
L[ 2][i] = 0.5f*V[2][i] + 0.25f*V[1][i] + 0.25f*V[3][i]; |
|
157 |
L[ 3][i] = 0.5f*V[0][i] + 0.25f*V[2][i] + 0.25f*V[3][i]; |
|
158 |
L[ 4][i] = 0.5f*V[2][i] + 0.25f*V[0][i] + 0.25f*V[3][i]; |
|
159 |
L[ 5][i] = 0.5f*V[3][i] + 0.25f*V[0][i] + 0.25f*V[2][i]; |
|
160 |
L[ 6][i] = 0.5f*V[3][i] + 0.25f*V[1][i] + 0.25f*V[0][i]; |
|
161 |
L[ 7][i] = 0.5f*V[0][i] + 0.25f*V[1][i] + 0.25f*V[3][i]; |
|
162 |
L[ 8][i] = 0.5f*V[1][i] + 0.25f*V[0][i] + 0.25f*V[3][i]; |
|
163 |
L[ 9][i] = 0.5f*V[2][i] + 0.25f*V[1][i] + 0.25f*V[0][i]; |
|
164 |
L[10][i] = 0.5f*V[0][i] + 0.25f*V[1][i] + 0.25f*V[2][i]; |
|
165 |
L[11][i] = 0.5f*V[1][i] + 0.25f*V[0][i] + 0.25f*V[2][i]; |
|
166 |
} |
|
167 |
} |
|
168 |
|
|
124 | 169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 170 |
|
126 | 171 |
public float[][] getCubitPositions(int[] numLayers) |
127 | 172 |
{ |
128 | 173 |
if( mPosition==null ) |
129 | 174 |
{ |
175 |
if( V==null ) initVertices(); |
|
176 |
|
|
130 | 177 |
mPosition = new float[][] |
131 | 178 |
{ |
132 |
// TODO |
|
179 |
{V[1][0],V[1][1],V[1][2]}, |
|
180 |
{V[0][0],V[0][1],V[0][2]}, |
|
181 |
{V[2][0],V[2][1],V[2][2]}, |
|
182 |
{V[3][0],V[3][1],V[3][2]}, |
|
183 |
|
|
184 |
{M[0][0],M[0][1],M[0][2]}, |
|
185 |
{M[1][0],M[1][1],M[1][2]}, |
|
186 |
{M[2][0],M[2][1],M[2][2]}, |
|
187 |
{M[3][0],M[3][1],M[3][2]}, |
|
188 |
|
|
189 |
{L[ 0][0],L[ 0][1],L[ 0][2]}, |
|
190 |
{L[ 1][0],L[ 1][1],L[ 1][2]}, |
|
191 |
{L[ 2][0],L[ 2][1],L[ 2][2]}, |
|
192 |
{L[ 3][0],L[ 3][1],L[ 3][2]}, |
|
193 |
{L[ 4][0],L[ 4][1],L[ 4][2]}, |
|
194 |
{L[ 5][0],L[ 5][1],L[ 5][2]}, |
|
195 |
{L[ 6][0],L[ 6][1],L[ 6][2]}, |
|
196 |
{L[ 7][0],L[ 7][1],L[ 7][2]}, |
|
197 |
{L[ 8][0],L[ 8][1],L[ 8][2]}, |
|
198 |
{L[ 9][0],L[ 9][1],L[ 9][2]}, |
|
199 |
{L[10][0],L[10][1],L[10][2]}, |
|
200 |
{L[11][0],L[11][1],L[11][2]}, |
|
133 | 201 |
}; |
134 | 202 |
} |
135 | 203 |
|
... | ... | |
140 | 208 |
|
141 | 209 |
public Static4D getCubitQuats(int cubit, int[] numLayers) |
142 | 210 |
{ |
143 |
switch(cubit) |
|
211 |
if( mQuatIndex==null ) mQuatIndex = new int[] {0,6,1,2, |
|
212 |
0,5,4,3, |
|
213 |
0,2,1,10,8,5,11,7,4,9,6,3 }; |
|
214 |
return mObjectQuats[mQuatIndex[cubit]]; |
|
215 |
} |
|
216 |
|
|
217 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
218 |
|
|
219 |
private float[] rotateVertices(float angle, float[] vector, float[] center, float[] rotAxis) |
|
220 |
{ |
|
221 |
float[] ret = new float[4]; |
|
222 |
float sin = (float)Math.sin(angle/2); |
|
223 |
float cos = (float)Math.cos(angle/2); |
|
224 |
float[] quat= new float[] { sin*rotAxis[0], sin*rotAxis[1], sin*rotAxis[2], cos}; |
|
225 |
QuatHelper.rotateVectorByQuat(ret,vector,quat); |
|
226 |
|
|
227 |
ret[0] += center[0]; |
|
228 |
ret[1] += center[1]; |
|
229 |
ret[2] += center[2]; |
|
230 |
|
|
231 |
return ret; |
|
232 |
} |
|
233 |
|
|
234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
235 |
|
|
236 |
private void normalize(float[] v) |
|
237 |
{ |
|
238 |
float len = (float)Math.sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); |
|
239 |
v[0] /= len; |
|
240 |
v[1] /= len; |
|
241 |
v[2] /= len; |
|
242 |
} |
|
243 |
|
|
244 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
245 |
|
|
246 |
private float[][] produceCorner() |
|
247 |
{ |
|
248 |
float[][] ret = new float[5 + 3*(N+1)][]; |
|
249 |
|
|
250 |
ret[0] = new float[] { 0.00f, 0.0f , 0.00f }; |
|
251 |
ret[1] = new float[] { 0.00f, 0.0f ,-1.50f }; |
|
252 |
ret[2] = new float[] { 0.75f, 0.75f*SQ2,-0.75f }; |
|
253 |
ret[3] = new float[] {-0.75f, 0.75f*SQ2,-0.75f }; |
|
254 |
ret[4] = new float[] { 0.00f, 0.75f*SQ2,-1.50f }; |
|
255 |
|
|
256 |
float[] vect1 = new float[4]; |
|
257 |
float[] vect2 = new float[4]; |
|
258 |
float[] vect3 = new float[4]; |
|
259 |
|
|
260 |
for(int i=0; i<3; i++) |
|
261 |
{ |
|
262 |
vect1[i] = -D*M[0][i] + D*(V[1][i]+V[3][i])/2; |
|
263 |
vect2[i] = -D*M[3][i] + D*(V[1][i]+V[2][i])/2; |
|
264 |
vect3[i] = -D*M[2][i] + D*(V[0][i]+V[1][i])/2; |
|
265 |
} |
|
266 |
|
|
267 |
float[] rot1 = new float[] { V[0][0]-M[0][0], V[0][1]-M[0][1], V[0][2]-M[0][2] }; |
|
268 |
float[] rot2 = new float[] { V[3][0]-M[3][0], V[3][1]-M[3][1], V[3][2]-M[3][2] }; |
|
269 |
float[] rot3 = new float[] { V[2][0]-M[2][0], V[2][1]-M[2][1], V[2][2]-M[2][2] }; |
|
270 |
|
|
271 |
normalize(rot1); |
|
272 |
normalize(rot2); |
|
273 |
normalize(rot3); |
|
274 |
|
|
275 |
float[] center1 = { M[0][0]-V[1][0], M[0][1]-V[1][1], M[0][2]-V[1][2] }; |
|
276 |
float[] center2 = { M[3][0]-V[1][0], M[3][1]-V[1][1], M[3][2]-V[1][2] }; |
|
277 |
float[] center3 = { M[2][0]-V[1][0], M[2][1]-V[1][1], M[2][2]-V[1][2] }; |
|
278 |
|
|
279 |
for(int i=0; i<N+1; i++) |
|
280 |
{ |
|
281 |
float angle = (float)(2*Math.PI/3)*i/N; |
|
282 |
|
|
283 |
ret[5 +i] = rotateVertices(angle,vect1,center1,rot1); |
|
284 |
ret[5+ N+1 +i] = rotateVertices(angle,vect2,center2,rot2); |
|
285 |
ret[5+2*(N+1)+i] = rotateVertices(angle,vect3,center3,rot3); |
|
286 |
} |
|
287 |
|
|
288 |
return ret; |
|
289 |
} |
|
290 |
|
|
291 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
292 |
|
|
293 |
private float[][] produceCenter() |
|
294 |
{ |
|
295 |
float[][] ret = new float[3*N+1][]; |
|
296 |
|
|
297 |
float[] rot = new float[] { V[0][0]-M[0][0], V[0][1]-M[0][1], V[0][2]-M[0][2] }; |
|
298 |
normalize(rot); |
|
299 |
|
|
300 |
float[] center1 = { 0.0f,-D*SQ2 , D }; |
|
301 |
float[] center2 = { D*1.5f, D*SQ2/2,-D/2}; |
|
302 |
float[] center3 = {-D*1.5f, D*SQ2/2,-D/2}; |
|
303 |
|
|
304 |
float[] vect1 = { D*0.75f, D*0.75f*SQ2, -D*0.75f, 0.0f }; |
|
305 |
float[] vect2 = { -D*1.50f, 0.00f , 0.00f, 0.0f }; |
|
306 |
float[] vect3 = { D*0.75f,-D*0.75f*SQ2, D*0.75f, 0.0f }; |
|
307 |
|
|
308 |
for(int i=0; i<N; i++) |
|
309 |
{ |
|
310 |
float angle = (float)(Math.PI/3)*i/N; |
|
311 |
|
|
312 |
ret[ N-1-i] = rotateVertices(angle, vect1, center1, rot); |
|
313 |
ret[2*N-1-i] = rotateVertices(angle, vect2, center2, rot); |
|
314 |
ret[3*N-1-i] = rotateVertices(angle, vect3, center3, rot); |
|
315 |
} |
|
316 |
|
|
317 |
ret[3*N] = new float[] { 0.0f, -SQ2/4, -0.5f }; |
|
318 |
|
|
319 |
return ret; |
|
320 |
} |
|
321 |
|
|
322 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
323 |
|
|
324 |
private float[][] produceLeaf() |
|
325 |
{ |
|
326 |
float[][] ret = new float[2*N+1][]; |
|
327 |
|
|
328 |
float[] rot = new float[] { V[0][0]-M[0][0], V[0][1]-M[0][1], V[0][2]-M[0][2] }; |
|
329 |
normalize(rot); |
|
330 |
|
|
331 |
float[] center1 = { 0.0f, -D*0.75f*SQ2, D*0.75f }; |
|
332 |
float[] center2 = { 0.0f, 0.25f*SQ2, -0.25f }; |
|
333 |
|
|
334 |
float[] vect1 = { D*0.75f, D*0.75f*SQ2, -D*0.75f, 0.0f }; |
|
335 |
float[] vect2 = new float[4]; |
|
336 |
for(int i=0; i<3; i++) vect2[i] = -D*M[0][i] + D*(V[1][i]+V[3][i])/2; |
|
337 |
|
|
338 |
for(int i=0; i<N; i++) |
|
144 | 339 |
{ |
145 |
// TODO |
|
340 |
float angle1 = (float)( Math.PI/3)*i/N; |
|
341 |
float angle2 = (float)(2*Math.PI/3)*i/N; |
|
342 |
|
|
343 |
ret[ N-1-i] = rotateVertices(angle1, vect1, center1, rot); |
|
344 |
ret[2*N-1-i] = rotateVertices(angle2, vect2, center2, rot); |
|
146 | 345 |
} |
147 | 346 |
|
148 |
return null; |
|
347 |
ret[2*N] = new float[] { 0.0f, -0.75f*SQ2/10, -1.5f/10 }; |
|
348 |
|
|
349 |
return ret; |
|
149 | 350 |
} |
150 | 351 |
|
151 | 352 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
152 | 353 |
|
153 | 354 |
private float[][] getVertices(int variant) |
154 | 355 |
{ |
155 |
if( variant==0 ) |
|
356 |
if( variant==0 ) return produceCorner(); |
|
357 |
else if( variant==1 ) return produceCenter(); |
|
358 |
else return produceLeaf(); |
|
359 |
} |
|
360 |
|
|
361 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
362 |
|
|
363 |
private int[][] produceCornerShape() |
|
364 |
{ |
|
365 |
int[][] ret = new int[9+3*N][]; |
|
366 |
|
|
367 |
ret[0] = new int[N+4]; |
|
368 |
ret[0][0] = 3; |
|
369 |
ret[0][1] = 0; |
|
370 |
ret[0][2] = 2; |
|
371 |
for(int i=0; i<N+1; i++) ret[0][3+i] = 5+N-i; |
|
372 |
|
|
373 |
ret[1] = new int[N+4]; |
|
374 |
ret[1][0] = 2; |
|
375 |
ret[1][1] = 0; |
|
376 |
ret[1][2] = 1; |
|
377 |
for(int i=0; i<N+1; i++) ret[1][3+i] = 6+2*N-i; |
|
378 |
|
|
379 |
ret[2] = new int[N+4]; |
|
380 |
ret[2][0] = 1; |
|
381 |
ret[2][1] = 0; |
|
382 |
ret[2][2] = 3; |
|
383 |
for(int i=0; i<N+1; i++) ret[2][3+i] = 7+3*N-i; |
|
384 |
|
|
385 |
ret[3] = new int[] {5+ N,2 , 4 }; |
|
386 |
ret[4] = new int[] {2 ,6+ N, 4 }; |
|
387 |
ret[5] = new int[] {6+2*N,1 , 4 }; |
|
388 |
ret[6] = new int[] {1 ,7+2*N, 4 }; |
|
389 |
ret[7] = new int[] {7+3*N,3 , 4 }; |
|
390 |
ret[8] = new int[] {3 ,5 , 4 }; |
|
391 |
|
|
392 |
for(int i=0; i<N; i++) |
|
156 | 393 |
{ |
157 |
return new float[][] |
|
158 |
{ |
|
159 |
// TODO |
|
160 |
}; |
|
394 |
ret[9+ i] = new int[] {5 +i, 6 +i, 4}; |
|
395 |
ret[9+ N+i] = new int[] {6+ N+i, 7+ N+i, 4}; |
|
396 |
ret[9+2*N+i] = new int[] {7+2*N+i, 8+2*N+i, 4}; |
|
161 | 397 |
} |
162 |
else if( variant==1 ) |
|
398 |
|
|
399 |
return ret; |
|
400 |
} |
|
401 |
|
|
402 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
403 |
|
|
404 |
private int[][] produceCenterShape() |
|
405 |
{ |
|
406 |
int[][] ret = new int[3+3*(N-1)+1][]; |
|
407 |
|
|
408 |
ret[0] = new int[3*N]; |
|
409 |
for(int i=0; i<3*N; i++) ret[0][i] = 3*N-1-i; |
|
410 |
|
|
411 |
for(int i=1; i<=N-1; i++) |
|
163 | 412 |
{ |
164 |
return new float[][] |
|
165 |
{ |
|
166 |
// TODO |
|
167 |
}; |
|
413 |
ret[i] = new int[3]; |
|
414 |
ret[i][0] = i; |
|
415 |
ret[i][1] = i-1; |
|
416 |
ret[i][2] = 3*N; |
|
417 |
|
|
418 |
ret[N-1+i] = new int[3]; |
|
419 |
ret[N-1+i][0] = N+i; |
|
420 |
ret[N-1+i][1] = N+i-1; |
|
421 |
ret[N-1+i][2] = 3*N; |
|
422 |
|
|
423 |
ret[2*N-2+i] = new int[3]; |
|
424 |
ret[2*N-2+i][0] = 2*N+i; |
|
425 |
ret[2*N-2+i][1] = 2*N+i-1; |
|
426 |
ret[2*N-2+i][2] = 3*N; |
|
168 | 427 |
} |
169 |
else |
|
428 |
|
|
429 |
ret[3*N-2] = new int[] { N-1, N, 3*N }; |
|
430 |
ret[3*N-1] = new int[] { 2*N-1, 2*N, 3*N }; |
|
431 |
ret[3*N ] = new int[] { 3*N-1, 0, 3*N }; |
|
432 |
|
|
433 |
return ret; |
|
434 |
} |
|
435 |
|
|
436 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
437 |
|
|
438 |
private int[][] produceLeafShape() |
|
439 |
{ |
|
440 |
int[][] ret = new int[2+2*(N-1)+1][]; |
|
441 |
|
|
442 |
ret[0] = new int[2*N]; |
|
443 |
for(int i=0; i<2*N; i++) ret[0][i] = 2*N-1-i; |
|
444 |
|
|
445 |
for(int i=1; i<=N-1; i++) |
|
170 | 446 |
{ |
171 |
return new float[][] |
|
172 |
{ |
|
173 |
// TODO |
|
174 |
}; |
|
447 |
ret[i] = new int[3]; |
|
448 |
ret[i][0] = i; |
|
449 |
ret[i][1] = i-1; |
|
450 |
ret[i][2] = 2*N; |
|
451 |
|
|
452 |
ret[N-1+i] = new int[3]; |
|
453 |
ret[N-1+i][0] = N+i; |
|
454 |
ret[N-1+i][1] = N+i-1; |
|
455 |
ret[N-1+i][2] = 2*N; |
|
175 | 456 |
} |
457 |
|
|
458 |
ret[2*N-1] = new int[] { N, N-1, 2*N }; |
|
459 |
ret[2*N ] = new int[] { 0,2*N-1, 2*N }; |
|
460 |
|
|
461 |
return ret; |
|
176 | 462 |
} |
177 | 463 |
|
178 | 464 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
181 | 467 |
{ |
182 | 468 |
if( variant==0 ) |
183 | 469 |
{ |
184 |
int[][] indices = |
|
185 |
{ |
|
186 |
// TODO |
|
187 |
}; |
|
188 |
|
|
470 |
int[][] indices = produceCornerShape(); |
|
189 | 471 |
return new ObjectShape(getVertices(variant), indices); |
190 | 472 |
} |
191 | 473 |
else if( variant==1 ) |
192 | 474 |
{ |
193 |
int[][] indices = |
|
194 |
{ |
|
195 |
// TODO |
|
196 |
}; |
|
197 |
|
|
475 |
int[][] indices = produceCenterShape(); |
|
198 | 476 |
return new ObjectShape(getVertices(variant), indices); |
199 | 477 |
} |
200 | 478 |
else |
201 | 479 |
{ |
202 |
int[][] indices = |
|
203 |
{ |
|
204 |
// TODO |
|
205 |
}; |
|
206 |
|
|
480 |
int[][] indices = produceLeafShape(); |
|
207 | 481 |
return new ObjectShape(getVertices(variant), indices); |
208 | 482 |
} |
209 | 483 |
} |
210 | 484 |
|
211 | 485 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
212 |
// TODO |
|
213 | 486 |
|
214 | 487 |
public ObjectFaceShape getObjectFaceShape(int variant) |
215 | 488 |
{ |
216 | 489 |
if( variant==0 ) |
217 | 490 |
{ |
218 |
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
|
491 |
float h1 = isInIconMode() ? 0.001f : 0.035f;
|
|
219 | 492 |
float h2 = isInIconMode() ? 0.001f : 0.01f; |
220 |
float[][] bands = { {h1,35,0.5f,0.7f,5,2,2}, {h2,35,0.2f,0.4f,5,2,2} }; |
|
221 |
int[] indices = { 0,0,0,1,1,1,1,1,1 }; |
|
222 |
return new ObjectFaceShape(bands,indices,null); |
|
493 |
float[][] bands = { {h1,35,0.2f,0.4f,5,1,0}, {h2,35,0.2f,0.4f,2,0,0} }; |
|
494 |
int[] indices = new int[9+3*N]; |
|
495 |
for(int i=3; i<9+3*N; i++) indices[i] = 1; |
|
496 |
float A = 0.5f; |
|
497 |
float[] convexCenter = { 0.0f*A, 0.75f*SQ2*A, -1.50f*A}; |
|
498 |
return new ObjectFaceShape(bands,indices,convexCenter); |
|
223 | 499 |
} |
224 | 500 |
else if( variant==1 ) |
225 | 501 |
{ |
226 |
float h1 = isInIconMode() ? 0.001f : 0.06f; |
|
227 |
float h2 = isInIconMode() ? 0.001f : 0.01f; |
|
228 |
float[][] bands = { {h1,35,0.5f,0.7f,5,2,2}, {h2,35,0.2f,0.4f,5,2,2} }; |
|
229 |
int[] indices = { 0,0,0,1,1,1,1,1,1 }; |
|
502 |
float h1 = isInIconMode() ? 0.001f : 0.00f; |
|
503 |
float h2 = isInIconMode() ? 0.001f : 0.00f; |
|
504 |
float[][] bands = { {h1,15,0.1f,0.2f,5,0,0}, {h2,15,0.1f,0.2f,2,0,0} }; |
|
505 |
int num = 3+3*(N-1)+1; |
|
506 |
int[] indices = new int[num]; |
|
507 |
for(int i=1; i<num; i++) indices[i] = 1; |
|
230 | 508 |
return new ObjectFaceShape(bands,indices,null); |
231 | 509 |
} |
232 | 510 |
else |
233 | 511 |
{ |
234 |
float h1 = isInIconMode() ? 0.001f : 0.038f; |
|
235 |
float h2 = isInIconMode() ? 0.001f : 0.020f; |
|
236 |
float[][] bands = { {h1,35,0.250f,0.7f,7,2,2}, {h2,35,0.125f,0.2f,3,1,2}, {h2,35,0.125f,0.2f,3,1,1} }; |
|
237 |
int[] indices = { 0,0,1,1,2,2 }; |
|
512 |
float h1 = isInIconMode() ? 0.001f : 0.0f; |
|
513 |
float h2 = isInIconMode() ? 0.001f : 0.0f; |
|
514 |
float[][] bands = { {h1,15,0.250f,0.7f,5,0,0}, {h2,15,0.125f,0.2f,2,0,0} }; |
|
515 |
int num = 2+2*(N-1)+1; |
|
516 |
int[] indices = new int[num]; |
|
517 |
for(int i=1; i<num; i++) indices[i] = 1; |
|
238 | 518 |
return new ObjectFaceShape(bands,indices,null); |
239 | 519 |
} |
240 | 520 |
} |
... | ... | |
245 | 525 |
{ |
246 | 526 |
if( variant==0 ) |
247 | 527 |
{ |
248 |
float[][] corners = { {0.06f,0.12f} }; |
|
249 |
int[] indices = { }; // TODO |
|
250 |
float[][] centers = { { 0.0f, 0.0f, 0.0f} }; |
|
528 |
float[][] corners = { {0.04f,0.15f} }; |
|
529 |
int[] indices = new int[5 + 3*(N+1)]; |
|
530 |
for(int i=4; i<5 + 3*(N+1); i++) indices[i] = -1; |
|
531 |
float[][] centers = { { 0.00f, 0.75f*SQ2,-1.50f} }; |
|
251 | 532 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices); |
252 | 533 |
} |
253 | 534 |
else if( variant==1 ) |
254 | 535 |
{ |
255 | 536 |
float[][] corners = { {0.06f,0.12f} }; |
256 |
int[] indices = { }; // TODO |
|
257 |
float[][] centers = { { } }; // TODO |
|
537 |
int[] indices = new int[3*N+1]; |
|
538 |
for(int i=0; i<3*N+1; i++) indices[i] = -1; |
|
539 |
float[][] centers = { { 0,0,0 } }; |
|
258 | 540 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices); |
259 | 541 |
} |
260 | 542 |
else |
261 | 543 |
{ |
262 | 544 |
float[][] corners = { {0.06f,0.20f} }; |
263 |
int[] indices = { }; // TODO |
|
264 |
float[][] centers = { { } }; // TODO |
|
545 |
int[] indices = new int[2*N+1]; |
|
546 |
for(int i=0; i<2*N+1; i++) indices[i] = -1; |
|
547 |
float[][] centers = { { 0,0,0 } }; |
|
265 | 548 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices); |
266 | 549 |
} |
267 | 550 |
} |
... | ... | |
277 | 560 |
|
278 | 561 |
public int getCubitVariant(int cubit, int[] numLayers) |
279 | 562 |
{ |
280 |
return cubit<4 ? 0 : (cubit<16 ? 1:2);
|
|
563 |
return cubit<4 ? 0 : (cubit<8 ? 1:2);
|
|
281 | 564 |
} |
282 | 565 |
|
283 | 566 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Coin Tetrahedron: progress