[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model ClippingPlane.java, 1.31, 1.32
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2008-09-09 14:02:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv20579/src/net/sourceforge/bprocessor/model Modified Files: ClippingPlane.java Log Message: ClippingPlane improvements Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ClippingPlane.java 9 Sep 2008 13:42:54 -0000 1.31 --- ClippingPlane.java 9 Sep 2008 14:03:09 -0000 1.32 *************** *** 8,16 **** import java.util.Collection; - import java.util.HashMap; import java.util.Iterator; import java.util.ArrayList; import java.util.List; - import java.util.Map; import java.util.Set; import java.util.HashSet; --- 8,14 ---- *************** *** 36,42 **** /** The silhouette */ private ArrayList<Edge> silhouette; - - /** The edge map */ - private Map<Edge, Edge> e2e; /** The plane of the ClippingPlane */ --- 34,37 ---- *************** *** 59,63 **** this.silhouette = new ArrayList<Edge>(); this.corners = new ArrayList<Vertex>(); - this.e2e = new HashMap(); Project.getInstance().addObserver(this); } --- 54,57 ---- *************** *** 105,108 **** --- 99,103 ---- public void update() { plane = null; + computeSilhouette(); findCorners(); } *************** *** 195,210 **** ! ! /** ! * Find intersections with all edges and return the vertices ! * (Have side effects) ! * @return The set of all intersection vertices ! */ ! public Collection<Vertex> findIntersections() { ! e2e.clear(); Container space = Project.getInstance().getActiveSpace(); Collection<Edge> edges = Geometry.getActiveEdges(space); silhouette.clear(); - Collection<Vertex> vertices = new ArrayList<Vertex>(); Plane plane = system.plane(); for (Edge current : edges) { --- 190,197 ---- ! private void computeSilhouette() { Container space = Project.getInstance().getActiveSpace(); Collection<Edge> edges = Geometry.getActiveEdges(space); silhouette.clear(); Plane plane = system.plane(); for (Edge current : edges) { *************** *** 212,224 **** Edge edge = current.copy(); edge.setStrippled(false); - vertices.add(edge.getFrom()); - vertices.add(edge.getTo()); silhouette.add(edge); - e2e.put(edge, current); - } else { - Vertex intersection = plane.intersection(current); - if (intersection != null) { - vertices.add(intersection); - } } } --- 199,203 ---- *************** *** 237,241 **** first = null; silhouette.add(newE); - e2e.put(newE, newE); break; } --- 216,219 ---- *************** *** 243,247 **** } } ! return vertices; } --- 221,235 ---- } } ! } ! ! ! ! /** ! * Find intersections with all edges and return the vertices ! * (Have side effects) ! * @return The set of all intersection vertices ! */ ! public Collection<Vertex> findIntersections() { ! return Edge.vertices(silhouette); } *************** *** 251,255 **** */ public void findCorners() { ! Collection c = this.findIntersections(); CoordinateSystem system = getPlane().coordinateSystem(); if (c.isEmpty()) { --- 239,243 ---- */ public void findCorners() { ! Collection c = findIntersections(); CoordinateSystem system = getPlane().coordinateSystem(); if (c.isEmpty()) { *************** *** 389,407 **** this.slice = slice; } - - /** - * Find the edge or surface the given edge correspond to in the model - * @param e the Edge in the contour - * @return The geometry in the model or null if none - */ - public Geometric toModel(Edge e) { - if (e2e != null) { - Object o = e2e.get(e); - if (o != null) { - return (Geometric)o; - } - } - return null; - } /** --- 377,380 ---- |