[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Plane.java, 1.37, 1.38
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2008-10-15 08:19:10
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32062/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: Section algorithm Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Plane.java 8 Oct 2008 10:26:39 -0000 1.37 --- Plane.java 15 Oct 2008 08:18:57 -0000 1.38 *************** *** 232,235 **** --- 232,236 ---- public Container intersection(Mesh input) { Container silhouette = new Container("Section", Space.CONSTRUCTION, true); + List<Surface> surfaces = new LinkedList(); List<Entry> entries = new LinkedList(); Map map = new HashMap(); *************** *** 271,274 **** --- 272,276 ---- { LinkedList<Vertex> intersections = new LinkedList(); + List<Edge> lst = new LinkedList(); Vertex from = current.getFirstVertex(); Vertex to = null; *************** *** 277,289 **** --- 279,302 ---- if (contains(from)) { intersections.add(from); + lst.add((Edge) edge.copy(map)); } else if (!contains(to)) { Vertex intersection = intersection(edge); if (intersection != null) { intersections.add(intersection); + Edge e1 = new Edge((Vertex) from.copy(map), intersection); + Edge e2 = new Edge(intersection, (Vertex) to.copy(map)); + lst.add(e1); + lst.add(e2); + } else { + lst.add((Edge) edge.copy(map)); } + } else { + lst.add((Edge) edge.copy(map)); } from = to; } + + if (intersections.size() > 1) { { *************** *** 332,335 **** --- 345,377 ---- } } + { + List<Edge> frame = new LinkedList(); + for (Edge edge : lst) { + frame.add(silhouette.insert(edge)); + } + + Vertex normal = current.normal(); + + Surface leader = new Surface(frame); + silhouette.add(leader); + Vertex n = leader.normal(); + Container front = current.getFrontDomain(); + front = (Container) map.get(front); + Container back = current.getBackDomain(); + back = (Container) map.get(back); + if (n.dot(normal) < 0) { + leader.setFrontDomain(back); + leader.setBackDomain(front); + } else { + leader.setFrontDomain(front); + leader.setBackDomain(back); + } + + CoordinateSystem system = current.coordinateSystem(); + SurfaceAnalysis analysis = new SurfaceAnalysis(); + EdgeStructure structure = analysis.new EdgeStructure(silhouette, system, frame); + Collection<Surface> faces = structure.surfaceAnalysis(frame); + surfaces.addAll(faces); + } } } *************** *** 337,345 **** } CoordinateSystem system = coordinateSystem(); SurfaceAnalysis analysis = new SurfaceAnalysis(); EdgeStructure structure = analysis.new EdgeStructure(silhouette, system, silhouette.getEdges()); ! structure.surfaceAnalysis(silhouette.getEdges()); return silhouette; --- 379,399 ---- } + + CoordinateSystem system = coordinateSystem(); SurfaceAnalysis analysis = new SurfaceAnalysis(); EdgeStructure structure = analysis.new EdgeStructure(silhouette, system, silhouette.getEdges()); ! Collection<Surface> faces = structure.surfaceAnalysis(silhouette.getEdges()); ! ! SpaceAnalysis analizer = new SpaceAnalysis(); ! for (Surface face : faces) { ! analizer.subsume(face, 1); ! analizer.subsume(face, -1); ! } ! ! for (Surface surface : surfaces) { ! surface.delete(); ! } return silhouette; |