Revision efcbfe8e
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/library/mesh/MeshMultigon.java | ||
---|---|---|
151 | 151 |
} |
152 | 152 |
} |
153 | 153 |
|
154 |
//android.util.Log.e("D", "curr vert: "+curr[0]+" "+curr[1]+" vect "+vect[0]+" "+vect[1]+" : "+x+" "+y); |
|
155 |
|
|
156 | 154 |
return new float[] {x,y}; |
157 | 155 |
} |
158 | 156 |
|
... | ... | |
217 | 215 |
int p = unclaimedEdges[nextIndex][0]; |
218 | 216 |
int v = unclaimedEdges[nextIndex][1]; |
219 | 217 |
edgesUp[p][v] = -holeNumber-2; |
220 |
|
|
221 |
//printEdgeEnds("HOLE "+holeNumber,vertices, p, v); |
|
222 |
|
|
223 | 218 |
currIndex = nextIndex; |
224 | 219 |
int[] e = unclaimedEdges[nextIndex]; |
225 | 220 |
float[] polygon = vertices[e[0]]; |
... | ... | |
302 | 297 |
float[][][] ret = new float[numHoles][][]; |
303 | 298 |
for(int h=0; h<numHoles; h++) ret[h] = holes.remove(0); |
304 | 299 |
|
305 |
//android.util.Log.e("D", "Holes: "+numHoles+" HoleVertices: "+mNumHoleVerts+" numOuterVerts: "+mNumOuterVerts); |
|
306 |
|
|
307 | 300 |
return ret; |
308 | 301 |
} |
309 | 302 |
|
... | ... | |
406 | 399 |
mEdgeVectors[c][v] = produceNormalVector(verts,xs,ys); |
407 | 400 |
} |
408 | 401 |
} |
409 |
//android.util.Log.e("D", "edgeVectors "+c+" "+v+" null: "+(mEdgeVectors[c][v]==null) ); |
|
410 | 402 |
} |
411 | 403 |
} |
412 | 404 |
} |
413 | 405 |
|
414 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
415 |
|
|
416 |
private void printEdgeEnds(String str, float[][] vertices, int p, int e) |
|
417 |
{ |
|
418 |
float[] polygon = vertices[p]; |
|
419 |
int len = polygon.length/2; |
|
420 |
int n = e<len-1 ? e+1 : 0; |
|
421 |
|
|
422 |
android.util.Log.e("D", str+" edge "+p+" "+e+" : ("+polygon[2*e]+" "+polygon[2*e+1]+") - ("+polygon[2*n]+" "+polygon[2*n+1]+")"); |
|
423 |
} |
|
424 |
|
|
425 | 406 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
426 | 407 |
// ret: |
427 | 408 |
// -1 : vertex (x,y) is 'inner' (does not belong to outer vertices or any hole) |
... | ... | |
652 | 633 |
|
653 | 634 |
int numOuterVerts= tmp.size(); |
654 | 635 |
float[][] outerVertices = new float[numOuterVerts][]; |
655 |
for(int i=0; i<numOuterVerts; i++) |
|
656 |
{ |
|
657 |
outerVertices[i] = tmp.remove(0); |
|
658 |
|
|
659 |
//if( mNumOuterVerts>14 ) |
|
660 |
// android.util.Log.e("D","outer: "+mOuterVertices[i][0]+" "+mOuterVertices[i][1]); |
|
661 |
} |
|
636 |
for(int i=0; i<numOuterVerts; i++) outerVertices[i] = tmp.remove(0); |
|
662 | 637 |
|
663 | 638 |
int numEdgesDown = countEdgesDown(edgesUp); |
664 | 639 |
int numHoleVerts= numEdgesDown-numOuterVerts; |
665 | 640 |
float[][][] holeVertices=null; |
666 |
|
|
667 |
if( numHoleVerts>0 ) |
|
668 |
{ |
|
669 |
holeVertices = computeHoles(vertices,edgesUp,outerVertices,numHoleVerts); |
|
670 |
} |
|
671 |
|
|
641 |
if( numHoleVerts>0 ) holeVertices = computeHoles(vertices,edgesUp,outerVertices,numHoleVerts); |
|
672 | 642 |
int numHoles = holeVertices==null ? 0 : holeVertices.length; |
673 | 643 |
float[][][] ret = new float[1+numHoles][][]; |
674 | 644 |
ret[0] = outerVertices; |
Also available in: Unified diff
minor