Project

General

Profile

« Previous | Next » 

Revision 4d27a99b

Added by Leszek Koltunski about 3 years ago

Make Ivy standard size (cube size=2, i.e. equal to numLayers so that DIST2D and DIST3D are standard)

View differences:

src/main/java/org/distorted/objects/MovementIvy.java
25 25

  
26 26
class MovementIvy extends Movement
27 27
{
28
  static final float DIST3D = 0.25f;
29
  static final float DIST2D = 0.25f;
28
  static final float DIST3D = 0.5f;
29
  static final float DIST2D = 0.5f;
30 30

  
31 31
  static final Static3D[] FACE_AXIS = new Static3D[]
32 32
         {
src/main/java/org/distorted/objects/TwistyIvy.java
52 52
         };
53 53

  
54 54
  private static final int NUM_STICKERS = 2;
55
  public static final float IVY_D = 0.003f;
55
  public static final float IVY_D = 0.006f;
56 56
  private static final int  IVY_N = 8;
57 57
  private static final int FACES_PER_CUBIT =6;
58 58

  
......
129 129

  
130 130
  float getScreenRatio()
131 131
    {
132
    return 1.0f;
132
    return 0.5f;
133 133
    }
134 134

  
135 135
///////////////////////////////////////////////////////////////////////////////////////////////////
......
187 187

  
188 188
  float[][] getCubitPositions(int numLayers)
189 189
    {
190
    final float DIST_CORNER = (numLayers-1)*0.50f;
191
    final float DIST_CENTER = (numLayers-1)*0.50f;
190
    final float DIST_CORNER = numLayers-1;
191
    final float DIST_CENTER = numLayers-1;
192 192

  
193 193
    final float[][] CENTERS = new float[10][];
194 194

  
......
217 217
      final float angle = (float)Math.PI/(2*IVY_N);
218 218
      final float CORR  = 1.0f - 2*IVY_D;
219 219

  
220
      float[][] centers= new float[][] { {-0.5f,-0.5f,-0.5f} };
221
      float[][] corners= new float[][] { {0.03f,0.10f}, {0.02f,0.10f} };
220
      float[][] centers= new float[][] { {-1.0f,-1.0f,-1.0f} };
221
      float[][] corners= new float[][] { {0.05f,0.20f}, {0.04f,0.20f} };
222 222
      int[] cornerIndices= new int[3*(IVY_N+1)+4];
223 223
      int[] centerIndices= new int[3*(IVY_N+1)+4];
224 224
      double[][] vertices= new double[3*(IVY_N+1)+4][3];
......
250 250
      vertices[0][0] = 0.0;
251 251
      vertices[0][1] = 0.0;
252 252
      vertices[0][2] = 0.0;
253
      vertices[1][0] =-1.0;
253
      vertices[1][0] =-2.0;
254 254
      vertices[1][1] = 0.0;
255 255
      vertices[1][2] = 0.0;
256 256
      vertices[2][0] = 0.0;
257
      vertices[2][1] =-1.0;
257
      vertices[2][1] =-2.0;
258 258
      vertices[2][2] = 0.0;
259 259
      vertices[3][0] = 0.0;
260 260
      vertices[3][1] = 0.0;
261
      vertices[3][2] =-1.0;
261
      vertices[3][2] =-2.0;
262 262

  
263 263
      vertIndices[0][0] = 2;
264 264
      vertIndices[0][1] = 0;
......
292 292
        double cos2 = Math.cos((      i)*angle);
293 293
        double sin2 = Math.sin((      i)*angle);
294 294

  
295
        vertices[N1+i][0] = CORR*(cos1-0.5) - 0.5;
296
        vertices[N1+i][1] = CORR*(sin1-0.5) - 0.5;
295
        vertices[N1+i][0] = CORR*(2*cos1-1.0) - 1.0;
296
        vertices[N1+i][1] = CORR*(2*sin1-1.0) - 1.0;
297 297
        vertices[N1+i][2] = 0.0;
298 298

  
299 299
        vertices[N2+i][0] = 0.0;
300
        vertices[N2+i][1] = CORR*(sin2-0.5) - 0.5;
301
        vertices[N2+i][2] = CORR*(cos2-0.5) - 0.5;
300
        vertices[N2+i][1] = CORR*(2*sin2-1.0) - 1.0;
301
        vertices[N2+i][2] = CORR*(2*cos2-1.0) - 1.0;
302 302

  
303
        vertices[N3+i][0] = CORR*(cos2-0.5) - 0.5;
303
        vertices[N3+i][0] = CORR*(2*cos2-1.0) - 1.0;
304 304
        vertices[N3+i][1] = 0.0;
305
        vertices[N3+i][2] = CORR*(sin2-0.5) - 0.5;
305
        vertices[N3+i][2] = CORR*(2*sin2-1.0) - 1.0;
306 306

  
307 307
        vertIndices[0][i+3] = N1 + i;
308 308
        vertIndices[1][i+3] = N2 + i;
......
312 312
        vertIndices[5][i+3] = N3 + i;
313 313
        }
314 314

  
315
      float C = 0.5f - SQ2/4;
315
      float C = 1.0f - SQ2/2;
316 316
      float[] convexCenter = new float[] {-C,-C,-C};
317 317
      return new ObjectShape(vertices,vertIndices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), convexCenter);
318 318
      }
......
325 325

  
326 326
      int[] bandIndices= new int[] { 0,1 };
327 327
      int[] indexes    = new int[2*IVY_N];
328
      float[][] corners= new float[][] { {0.03f,0.10f} };
329
      float[][] centers= new float[][] { {-0.0f,-0.0f,-0.5f} };
328
      float[][] corners= new float[][] { {0.05f,0.20f} };
329
      float[][] centers= new float[][] { {-0.0f,-0.0f,-1.0f} };
330 330

  
331 331
      for(int i=0; i<IVY_N; i++)
332 332
        {
333 333
        double sin = Math.sin(i*angle);
334 334
        double cos = Math.cos(i*angle);
335 335

  
336
        vertices[i      ][0] = CORR*(0.5f-cos);
337
        vertices[i      ][1] = CORR*(0.5f-sin);
336
        vertices[i      ][0] = CORR*(1.0f-2*cos);
337
        vertices[i      ][1] = CORR*(1.0f-2*sin);
338 338
        vertices[i      ][2] = 0;
339
        vertices[i+IVY_N][0] = CORR*(cos-0.5f);
340
        vertices[i+IVY_N][1] = CORR*(sin-0.5f);
339
        vertices[i+IVY_N][0] = CORR*(2*cos-1.0f);
340
        vertices[i+IVY_N][1] = CORR*(2*sin-1.0f);
341 341
        vertices[i+IVY_N][2] = 0;
342 342
        }
343 343

  

Also available in: Unified diff