[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Geometry.java,1.15,1.16
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-03-23 11:49:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10403/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: HoleAnalysis in Pencil Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Geometry.java 17 Mar 2006 09:30:34 -0000 1.15 --- Geometry.java 23 Mar 2006 11:49:55 -0000 1.16 *************** *** 10,13 **** --- 10,14 ---- import java.util.ArrayList; import java.util.Arrays; + import java.util.Collection; import java.util.HashSet; import java.util.Iterator; *************** *** 254,264 **** --- 255,269 ---- private static void findSurfaces(VertexNode vertex, EdgeNode last, List edges, Surface exterior) { int count = 0; + System.out.println("find-surfaces"); List surfaces = new LinkedList(); Mesh mesh = ((Edge) edges.iterator().next()).getMesh(); { + Surface clockwise = clockwiseSurface(vertex, last, edges); if (clockwise != null) { + if (clockwise.angle(vertex.system()) < 0) { mesh.add(clockwise); + holeAnalysis(clockwise); surfaces.add(clockwise); count++; *************** *** 266,274 **** } } ! { Surface counterclockwise = counterclockwiseSurface(vertex, last, edges); if (counterclockwise != null) { if (counterclockwise.angle(vertex.system()) > 0) { mesh.add(counterclockwise); surfaces.add(counterclockwise); count++; --- 271,280 ---- } } ! { Surface counterclockwise = counterclockwiseSurface(vertex, last, edges); if (counterclockwise != null) { if (counterclockwise.angle(vertex.system()) > 0) { mesh.add(counterclockwise); + holeAnalysis(counterclockwise); surfaces.add(counterclockwise); count++; *************** *** 606,608 **** --- 612,633 ---- } + /** + * See if surface has become a hole in a surface in + * the project. + * @param surface The surface + */ + public static void holeAnalysis(Surface surface) { + Collection surfaces = surface.getMesh().getSurfaces(); + Iterator iter = surfaces.iterator(); + while (iter.hasNext()) { + Surface current = (Surface) iter.next(); + if (current != surface) { + if (current.surrounds(surface)) { + current.addHole(surface); + } else if (surface.surrounds(current)) { + surface.addHole(current); + } + } + } + } } |