Project

General

Profile

« Previous | Next » 

Revision 898ff658

Added by Leszek Koltunski 10 months ago

another bugfix for MeshMultigon.

View differences:

src/main/java/org/distorted/library/mesh/MeshMultigon.java
34 34
 */
35 35
public class MeshMultigon extends MeshBase
36 36
  {
37
  private static final float MAX_ERROR = 0.0001f;
37
  private static final float MAX_ERROR = 0.000001f;
38 38
  private float[][] mOuterVertices;
39 39

  
40 40
///////////////////////////////////////////////////////////////////////////////////////////////////
......
129 129
    return diff<0 ? diff+(2*Math.PI) : diff;
130 130
    }
131 131

  
132
///////////////////////////////////////////////////////////////////////////////////////////////////
133

  
134
  private boolean pointsTheSame(float dx, float dy)
135
    {
136
    return dx*dx + dy*dy < 0.000001f;
137
    }
138

  
139 132
///////////////////////////////////////////////////////////////////////////////////////////////////
140 133

  
141 134
  private float[] detectNextOuterVertex(float[][] vertices, float[] curr, float[] vect)
......
152 145
        float xc = v[2*j];
153 146
        float yc = v[2*j+1];
154 147

  
155
        if( pointsTheSame(xc-curr[0],yc-curr[1]) )
148
        if( isSame(xc-curr[0],yc-curr[1]) )
156 149
          {
157 150
          int n = (j==num-1 ? 0 : j+1);
158 151
          float xn = v[2*n];
......
193 186
      vect[1] = prev[1]-next[1];
194 187
      tmp.add(next);
195 188
      }
196
    while( !pointsTheSame(next[0]-first[0],next[1]-first[1]) );
189
    while( !isSame(next[0]-first[0],next[1]-first[1]) );
197 190

  
198 191
    int num = tmp.size();
199 192
    mOuterVertices = new float[num][];
......
205 198
  private boolean doesntBelongToOuter(float x, float y)
206 199
    {
207 200
    for( float[] v : mOuterVertices )
208
      if( x==v[0] && y==v[1] ) return false;
201
      if( isSame(x-v[0],y-v[1]) ) return false;
209 202

  
210 203
    return true;
211 204
    }

Also available in: Unified diff