Project

General

Profile

« Previous | Next » 

Revision 6ddadae2

Added by Leszek Koltunski about 2 years ago

Improve FactorySticker some more.

View differences:

src/main/java/org/distorted/objectlib/helpers/FactorySticker.java
292 292
      {
293 293
      drawCurrSide(canvas,paint,left,top,stroke,prevX,prevY,currX,currY,prevA);
294 294

  
295
      prevX = currX;
296
      prevY = currY;
297
      currX = nextX;
298
      currY = nextY;
299

  
300
      prevA = currA;
301
      currA = getAngle(angles, vert==numVertices-1 ? 0 : vert+1);
302

  
303
      if( 2*(vert+2)+1 < length )
304
        {
305
        nextX = vertices[2*(vert+2)  ];
306
        nextY = vertices[2*(vert+2)+1];
307
        }
308
      else
309
        {
310
        nextX = vertices[0];
311
        nextY = vertices[1];
312
        }
313
      }
314

  
315
    prevX = vertices[length-2];
316
    prevY = vertices[length-1];
317
    currX = vertices[0];
318
    currY = vertices[1];
319
    nextX = vertices[2];
320
    nextY = vertices[3];
321

  
322
    prevA = getAngle(angles,numVertices-1);
323
    currA = getAngle(angles,0);
324

  
325
    for(int vert=0; vert<numVertices; vert++)
326
      {
295 327
      float prevAngle = computeSideAngle(currX-prevX,currY-prevY,-prevA);
296 328
      float currAngle = computeSideAngle(nextX-currX,nextY-currY,+currA);
297 329
      drawRoundCorner(canvas,paint,color,left,top,stroke,radii[vert],currX,currY,prevAngle,currAngle);
src/main/java/org/distorted/objectlib/objects/TwistyVoid.java
70 70

  
71 71
    mStickerCoords = new float[][]
72 72
          {
73
             { -0.5f, A, A, -0.5f, -0.5f, -0.5f },
74
             { -C, B, D, B, D, -B, -C, -B }
73
             { -0.5f, -0.5f, A, -0.5f, -0.5f, A },
74
             { -C, -B, D, -B, D, B, -C, B }
75 75
          };
76 76
    }
77 77

  
......
364 364

  
365 365
  public float getStickerRadius()
366 366
    {
367
    return 0.0f;
367
    return 0.02f;
368 368
    }
369 369

  
370 370
///////////////////////////////////////////////////////////////////////////////////////////////////
......
379 379
  public float[][] getStickerAngles()
380 380
    {
381 381
    float D = (float)(Math.PI/6);
382
    return new float[][] { { -D,0,0 },{ 0,0,0,D } };
382
    return new float[][] { { 0,D,0 },{ 0,0,0,-D } };
383 383
    }
384 384

  
385 385
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff