Revision 21be940a
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/library/mesh/MeshMultigon.java | ||
---|---|---|
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 |
|
|
132 | 139 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
133 | 140 |
|
134 | 141 |
private float[] detectNextOuterVertex(float[][] vertices, float[] curr, float[] vect) |
... | ... | |
145 | 152 |
float xc = v[2*j]; |
146 | 153 |
float yc = v[2*j+1]; |
147 | 154 |
|
148 |
if( xc==curr[0] && yc==curr[1])
|
|
155 |
if( pointsTheSame(xc-curr[0],yc-curr[1]) )
|
|
149 | 156 |
{ |
150 | 157 |
int n = (j==num-1 ? 0 : j+1); |
151 | 158 |
float xn = v[2*n]; |
... | ... | |
186 | 193 |
vect[1] = prev[1]-next[1]; |
187 | 194 |
tmp.add(next); |
188 | 195 |
} |
189 |
while( next[0]!=first[0] || next[1]!=first[1] );
|
|
196 |
while( !pointsTheSame(next[0]-first[0],next[1]-first[1]) );
|
|
190 | 197 |
|
191 | 198 |
int num = tmp.size(); |
192 | 199 |
mOuterVertices = new float[num][]; |
Also available in: Unified diff
bugfix for a crasher