[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Edge.java, 1.108, 1.109 ClippingPlan
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2008-10-08 10:27:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24813/src/net/sourceforge/bprocessor/model Modified Files: Edge.java ClippingPlane.java SurfaceAnalysis.java Space.java Plane.java Log Message: Clippingplane improved Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** Space.java 7 Apr 2008 11:20:31 -0000 1.234 --- Space.java 8 Oct 2008 10:26:39 -0000 1.235 *************** *** 416,420 **** @Override public String toString() { ! return "[" + getLevelString() + " " + getName() + "]"; } --- 416,420 ---- @Override public String toString() { ! return "[" + getLevelString() + " " + getDisplayName() + "]"; } *************** *** 664,667 **** --- 664,670 ---- return Project.getInstance().getName(); } else { + if (this.isVoid()) { + return "empty"; + } String lvl = getKindName(); if (lvl == null) { Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ClippingPlane.java 18 Sep 2008 10:43:14 -0000 1.34 --- ClippingPlane.java 8 Oct 2008 10:26:39 -0000 1.35 *************** *** 43,46 **** --- 43,48 ---- /** To make a visual slice */ private boolean slice = false; + + private boolean onlyLines = true; /** *************** *** 275,278 **** --- 277,296 ---- this.isActive = isActive; } + + /** + * + * @return only lines + */ + public boolean isOnlyLines() { + return onlyLines; + } + + /** + * + * @param value new value + */ + public void setOnlyLines(boolean value) { + onlyLines = value; + } /** {@inheritDoc} */ *************** *** 295,298 **** --- 313,321 ---- res.add(new Attribute("isSlice", Boolean.FALSE)); } + if (isOnlyLines()) { + res.add(new Attribute("Only Lines", Boolean.TRUE)); + } else { + res.add(new Attribute("Only Lines", Boolean.FALSE)); + } res.add(new Attribute("Flip", Boolean.FALSE)); return res; *************** *** 320,323 **** --- 343,348 ---- } else if (a.getName().equals("isSlice")) { setSlice(((Boolean)a.getValue()).booleanValue()); + } else if (a.getName().equals("Only Lines")) { + setOnlyLines(((Boolean)a.getValue()).booleanValue()); } else if (a.getName().equals("Flip")) { if ((Boolean)a.getValue() == Boolean.TRUE) { Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.108 retrieving revision 1.109 diff -C2 -d -r1.108 -r1.109 *** Edge.java 21 Jan 2008 13:37:25 -0000 1.108 --- Edge.java 8 Oct 2008 10:26:39 -0000 1.109 *************** *** 289,296 **** */ public boolean equivalent(Edge other) { ! if (other.getFrom() == from && other.getTo() == to) { return true; } ! if (other.getFrom() == to && other.getTo() == from) { return true; } --- 289,296 ---- */ public boolean equivalent(Edge other) { ! if (other.from.equalEps(from) && other.to.equalEps(to)) { return true; } ! if (other.to.equalEps(from) && other.from.equalEps(to)) { return true; } Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Plane.java 18 Sep 2008 10:43:14 -0000 1.36 --- Plane.java 8 Oct 2008 10:26:39 -0000 1.37 *************** *** 16,19 **** --- 16,21 ---- import java.util.Map; + import net.sourceforge.bprocessor.model.SurfaceAnalysis.EdgeStructure; + import org.apache.log4j.Logger; *************** *** 233,236 **** --- 235,247 ---- Map map = new HashMap(); Map<Edge, Entry> planar = new HashMap(); + for (Space current : input.elements()) { + if (!current.isVoid()) { + Space element = current.shallowCopy(); + map.put(current, element); + silhouette.add(element); + } else { + map.put(current, silhouette.getEmpty()); + } + } for (Edge current : input.edges()) { if (contains(current)) { *************** *** 249,252 **** --- 260,271 ---- entry.surfaces().add(current); } + Surface surface = (Surface) current.copy(map); + silhouette.insert(surface); + Space front = current.getFrontDomain(); + front = (Space) map.get(front); + Space back = current.getBackDomain(); + back = (Space) map.get(back); + surface.setFrontDomain((Container) front); + surface.setBackDomain((Container) back); } else { { *************** *** 320,412 **** CoordinateSystem system = coordinateSystem(); SurfaceAnalysis analysis = new SurfaceAnalysis(); - analysis.surfaceAnalysis(silhouette, coordinateSystem(), silhouette.getEdges()); ! { ! List<Vertex> vertices = new LinkedList(silhouette.getVertices()); ! system.translateIt(vertices); ! ! for (Entry current : entries) { ! current.order(); ! } ! ! { ! Iterator<Entry> iter = entries.iterator(); ! while (iter.hasNext()) { ! Entry current = iter.next(); ! if (current.ignore()) { ! iter.remove(); ! } ! } ! } ! ! final Comparator<Entry> compareY = new Comparator<Entry> () { ! public int compare(Entry left, Entry right) { ! if (left.y0 < right.y0) { ! return -1; ! } else if (left.y0 > right.y0) { ! return 1; ! } else { ! return 0; ! } ! } ! }; ! ! final Comparator<Entry> compareX = new Comparator<Entry> () { ! public int compare(Entry left, Entry right) { ! if (left.x < right.x) { ! return -1; ! } else if (left.x > right.x) { ! return 1; ! } else { ! return 0; ! } ! } ! }; ! ! Collections.sort(entries, compareY); ! ! ! Iterator<Entry> iterator = entries.iterator(); ! Entry next = iterator.next(); ! List<Entry> active = new LinkedList(); ! ! while (next != null) { ! double y = next.y0; ! // weed ! { ! Iterator<Entry> iter = active.iterator(); ! while (iter.hasNext()) { ! Entry current = iter.next(); ! if (current.y1 >= y) { ! iter.remove(); ! } ! } ! } ! // insert ! { ! while (next != null && next.y0 == y) { ! active.add(next); ! if (iterator.hasNext()) { ! next = iterator.next(); ! } else { ! next = null; ! } ! } ! } ! // intersection ! { ! Iterator<Entry> iter = active.iterator(); ! while (iter.hasNext()) { ! Entry current = iter.next(); ! current.findIntersectingX(y); ! } ! } ! // sort ! Collections.sort(active, compareX); ! // scan ! } ! ! system.unTranslateIt(vertices); ! } return silhouette; } --- 339,346 ---- CoordinateSystem system = coordinateSystem(); SurfaceAnalysis analysis = new SurfaceAnalysis(); ! EdgeStructure structure = analysis.new EdgeStructure(silhouette, system, silhouette.getEdges()); ! structure.surfaceAnalysis(silhouette.getEdges()); ! return silhouette; } Index: SurfaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceAnalysis.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SurfaceAnalysis.java 30 Sep 2008 13:20:46 -0000 1.17 --- SurfaceAnalysis.java 8 Oct 2008 10:26:39 -0000 1.18 *************** *** 280,283 **** --- 280,293 ---- private CoordinateSystem system; + + /** + * + * @param edge Edge + * @return EdgeNode + */ + public EdgeNode getEdgeNode(Edge edge) { + return emap.get(edge); + } + private List<Edge> rightContour(EdgeNode start) { List<Edge> edges = new LinkedList(); *************** *** 507,511 **** } ! private Collection<Surface> surfaceAnalysis(Collection<Edge> start) { Set<Surface> added = new HashSet(); Set<Surface> removed = new HashSet(); --- 517,526 ---- } ! /** ! * ! * @param start Collection of Edges ! * @return Collection of Surfaces ! */ ! public Collection<Surface> surfaceAnalysis(Collection<Edge> start) { Set<Surface> added = new HashSet(); Set<Surface> removed = new HashSet(); |