Project

General

Profile

« Previous | Next » 

Revision b394a751

Added by Leszek Koltunski over 1 year ago

bugfix for a crasher

View differences:

src/main/java/org/distorted/objectlib/helpers/FactoryCubit.java
220 220
    return diff<0 ? diff+(2*Math.PI) : diff;
221 221
    }
222 222

  
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224

  
225
  private boolean pointsTheSame(float dx, float dy)
226
    {
227
    return dx*dx + dy*dy < 0.000001f;
228
    }
229

  
223 230
///////////////////////////////////////////////////////////////////////////////////////////////////
224 231

  
225 232
  private float[] detectNextOuterVertex(float[][] vertices, float[] curr, float[] vect)
......
236 243
        float xc = v[2*j];
237 244
        float yc = v[2*j+1];
238 245

  
239
        if( xc==curr[0] && yc==curr[1])
246
        if( pointsTheSame(xc-curr[0],yc-curr[1]) )
240 247
          {
241 248
          int n = (j==num-1 ? 0 : j+1);
242 249
          float xn = v[2*n];
......
278 285
      vect[1] = prev[1]-next[1];
279 286
      tmp.add(next);
280 287
      }
281
    while( next[0]!=first[0] || next[1]!=first[1] );
288
    while( !pointsTheSame(next[0]-first[0],next[1]-first[1]) );
282 289

  
283 290
    int num = tmp.size();
284 291
    float[] ret = new float[2*num];

Also available in: Unified diff