Project

General

Profile

« Previous | Next » 

Revision 57ef6378

Added by Leszek Koltunski over 2 years ago

Float vertices - scratchbook

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyMegaminx.java
264 264
      float width = numL*(0.5f-MEGA_D)/(0.5f*(numL-1));
265 265
      float A = (2*SQ3/3)*SIN54;
266 266
      float B = 0.4f;
267
      double X = width*COS18*SIN_HALFD;
268
      double Y = width*SIN18;
269
      double Z = width*COS18*COS_HALFD;
267
      float X = width*COS18*SIN_HALFD;
268
      float Y = width*SIN18;
269
      float Z = width*COS18*COS_HALFD;
270 270

  
271
      double[][] vertices = new double[][]
271
      float[][] vertices = new float[][]
272 272
        {
273
            { 0.0, 0.0      , 0.0 },
273
            {   0,   0      ,   0 },
274 274
            {   X,   Y      ,  -Z },
275
            { 0.0, 2*Y      ,-2*Z },
275
            {   0, 2*Y      ,-2*Z },
276 276
            {  -X,   Y      ,  -Z },
277
            { 0.0, 0.0-width, 0.0 },
277
            {   0,   0-width,   0 },
278 278
            {   X,   Y-width,  -Z },
279
            { 0.0, 2*Y-width,-2*Z },
279
            {   0, 2*Y-width,-2*Z },
280 280
            {  -X,   Y-width,  -Z },
281 281
        };
282 282

  
......
310 310
      float height= numL*(0.5f-MEGA_D)*COS18/((numL-1)*0.5f);
311 311
      float width = numL*2*MEGA_D + 2*type*height*SIN18/COS18;
312 312

  
313
      double W = width/2;
314
      double X = height*SIN_HALFD;
315
      double Y = height*SIN18/COS18;
316
      double Z = height*COS_HALFD;
313
      float W = width/2;
314
      float X = height*SIN_HALFD;
315
      float Y = height*SIN18/COS18;
316
      float Z = height*COS_HALFD;
317 317

  
318
      double[][] vertices = new double[][]
318
      float[][] vertices = new float[][]
319 319
        {
320
            { 0.0,   W   , 0.0 },
320
            {   0,   W   ,   0 },
321 321
            {   X, W+Y   ,  -Z },
322
            { 0.0, W+2*Y ,-2*Z },
322
            {   0, W+2*Y ,-2*Z },
323 323
            {  -X, W+Y   ,  -Z },
324
            { 0.0,  -W   , 0.0 },
324
            {   0,  -W   ,   0 },
325 325
            {   X,-W-Y   ,  -Z },
326
            { 0.0,-W-2*Y ,-2*Z },
326
            {   0,-W-2*Y ,-2*Z },
327 327
            {  -X,-W-Y   ,  -Z },
328 328
        };
329 329

  
......
355 355
    else
356 356
      {
357 357
      float width = 2*numL*(MEGA_D+(0.5f-MEGA_D)*SIN18);
358
      final double V = 0.83;   // ??
358
      final float V = 0.83f;   // ??
359 359
      final double ANGLE = V*Math.PI;
360
      final double cosA  = Math.cos(ANGLE);
361
      final double sinA  = Math.sin(ANGLE);
360
      final float cosA  = (float)Math.cos(ANGLE);
361
      final float sinA  = (float)Math.sin(ANGLE);
362 362

  
363 363
      float R  = 0.5f*width/COS54;
364 364
      float X1 = R*COS54;
......
366 366
      float X2 = R*COS18;
367 367
      float Y2 = R*SIN18;
368 368

  
369
      double[][] vertices = new double[][]
369
      float[][] vertices = new float[][]
370 370
        {
371 371
          {-X1,+Y1*sinA, Y1*cosA},
372 372
          {-X2,-Y2*sinA,-Y2*cosA},
373
          {0.0f,-R*sinA, -R*cosA},
373
          { 0 ,-R*sinA, -R*cosA},
374 374
          {+X2,-Y2*sinA,-Y2*cosA},
375 375
          {+X1,+Y1*sinA, Y1*cosA}
376 376
        };

Also available in: Unified diff