Project

General

Profile

« Previous | Next » 

Revision c4f0dbce

Added by Leszek Koltunski over 3 years ago

improvements for FactorySticker

View differences:

src/main/java/org/distorted/helpers/FactorySticker.java
119 119
    if( sweepAngle<0 ) sweepAngle += 2*Math.PI;
120 120

  
121 121
    float R = r*TEXTURE_HEIGHT+stroke/2;
122
    float C = (float)Math.cos(sweepAngle/2);
123
    float A = R/C;
122 124

  
123
    float A = (float)(R/(Math.cos(sweepAngle/2)));
125
    left += (cX+A*sX);
126
    top  += (cY+A*sY);
124 127

  
125
    float rX = cX + A*sX;
126
    float rY = cY + A*sY;
128
    if( C< (2*R-stroke)/(2*R+stroke) )
129
      {
130
      float alpha = startAngle + sweepAngle/2;
131
      float B  = (R-stroke/2)/C;
132
      float sx = (float)Math.cos(alpha);
133
      float sy = (float)Math.sin(alpha);
134

  
135
      float startX = left + R*sx;
136
      float startY = top  + R*sy;
137
      float stopX  = left + B*sx;
138
      float stopY  = top  + B*sy;
139

  
140
      canvas.drawLine(startX,startY,stopX,stopY,paint);
141
      }
127 142

  
128 143
    startAngle *= 180/(Math.PI);
129 144
    sweepAngle *= 180/(Math.PI);
130 145

  
131
    canvas.drawArc( left+rX-R, top+rY-R, left+rX+R, top+rY+R, startAngle, sweepAngle, false, paint);
146
    canvas.drawArc( left-R, top-R, left+R, top+R, startAngle, sweepAngle, false, paint);
132 147
    }
133 148

  
134 149
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/main/RubikSurfaceView.java
372 372
        float distNow  = (float)Math.sqrt( (x-x2)*(x-x2) + (y-y2)*(y-y2) );
373 373
        float distQuot = mInitDistance<0 ? 1.0f : distNow/ mInitDistance;
374 374
        mInitDistance = distNow;
375

  
375
/*
376 376
if( angleDiff< 0.00001f && angleDiff>-0.00001f)
377 377
  android.util.Log.e("D", " distQuot="+distQuot);
378 378
else
379 379
 android.util.Log.e("D", "angelDiff "+angleDiff+" distQuot="+distQuot);
380

  
380
*/
381 381
        TwistyObject object = mPreRender.getObject();
382 382
        if( object!=null ) object.setObjectRatio(distQuot);
383 383
        }
src/main/java/org/distorted/objects/TwistySquare1.java
1 1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 Leszek Koltunski                                                               //
2
// Copyright 2021 Leszek Koltunski                                                               //
3 3
//                                                                                               //
4 4
// This file is part of Magic Cube.                                                              //
5 5
//                                                                                               //

Also available in: Unified diff