[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/model ClippingPlane.java,1.8,1.9
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2006-05-18 14:25:26
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24428/src/net/sourceforge/bprocessor/gl/model Modified Files: ClippingPlane.java Log Message: Calculate the silluete of cut surfaces and saves it in a list which can be fetched by getLines() Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/ClippingPlane.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ClippingPlane.java 13 Apr 2006 13:52:26 -0000 1.8 --- ClippingPlane.java 18 May 2006 14:25:23 -0000 1.9 *************** *** 15,18 **** --- 15,19 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Edge; *************** *** 41,44 **** --- 42,48 ---- private ArrayList corners; + /** The silluet */ + private ArrayList silluet; + /** * The constructor *************** *** 114,126 **** public Collection findIntersections() { Collection edges = Project.getInstance().getEdges(); Collection res = new ArrayList(); Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); ! Vertex v = plane.intersection(e); if (v != null) { res.add(v); } } return res; } --- 118,154 ---- public Collection findIntersections() { Collection edges = Project.getInstance().getEdges(); + silluet = new ArrayList(); Collection res = new ArrayList(); Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); ! Vertex v = plane.intersection(e); if (v != null) { res.add(v); } } + Collection surfaces = Project.getInstance().getSurfaces(); + it = surfaces.iterator(); + while (it.hasNext()) { + Surface s = (Surface)it.next(); + Collection lines = s.getEdges(); + Iterator iter = lines.iterator(); + Vertex first = null; + while (iter.hasNext()) { + Edge e = (Edge)iter.next(); + Vertex v = plane.intersection(e); + if (v != null) { + if (first == null) { + first = v; + } else { + Edge newE = new Edge(first, v); + newE.setConstructor(true); + first = null; + silluet.add(newE); + break; + } + } + } + } return res; } *************** *** 220,222 **** --- 248,258 ---- return "[" + p[0] + ", " + p[1] + ", " + p[2] + ", " + p[3] + "]"; } + + /** + * Gettter for the intersected geometry + * @return The intersection edges + */ + public Collection getLines() { + return silluet; + } } |