[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model ClippingPlane.java, 1.29, 1.30
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2008-09-09 12:14:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8845/src/net/sourceforge/bprocessor/model Modified Files: ClippingPlane.java Log Message: Improved clipping Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ClippingPlane.java 9 Sep 2008 08:01:29 -0000 1.29 --- ClippingPlane.java 9 Sep 2008 12:15:07 -0000 1.30 *************** *** 28,32 **** /** The placement of the ClippingPlane */ ! private CoordinateSystem cs; /** The corners */ --- 28,32 ---- /** The placement of the ClippingPlane */ ! private CoordinateSystem system; /** The corners */ *************** *** 53,59 **** */ public ClippingPlane(CoordinateSystem system) { ! this.cs = system; this.isActive = true; ! this.plane = cs.plane(); this.silhouette = new ArrayList<Edge>(); this.corners = new ArrayList<Vertex>(); --- 53,59 ---- */ public ClippingPlane(CoordinateSystem system) { ! this.system = system; this.isActive = true; ! this.plane = system.plane(); this.silhouette = new ArrayList<Edge>(); this.corners = new ArrayList<Vertex>(); *************** *** 67,71 **** */ public ClippingPlane copy() { ! ClippingPlane copy = new ClippingPlane(this.cs.copy()); copy.isActive = isActive(); return copy; --- 67,71 ---- */ public ClippingPlane copy() { ! ClippingPlane copy = new ClippingPlane(this.system.copy()); copy.isActive = isActive(); return copy; *************** *** 78,87 **** public Plane getPlane() { if (plane == null) { ! CoordinateSystem c = cs.copy(); ! Vertex n = c.getN().copy(); ! n.normalize(); ! n.scaleIt(0.00001); ! c.move(n.getX(), n.getY(), n.getZ()); ! plane = c.plane(); } return plane; --- 78,82 ---- public Plane getPlane() { if (plane == null) { ! plane = system.plane(); } return plane; *************** *** 93,97 **** */ public Vertex center() { ! return cs.getOrigin(); } --- 88,92 ---- */ public Vertex center() { ! return system.getOrigin(); } *************** *** 101,105 **** */ public Vertex getNormal() { ! return cs.getN().copy(); } --- 96,100 ---- */ public Vertex getNormal() { ! return system.getN().copy(); } *************** *** 159,162 **** --- 154,167 ---- c.removeClipplane(this); } + + /** + * Returns true if surface is contained in this ClippingPlane + * @param surface Surface to test + * @return true of the surface is contained + */ + public boolean contains(Surface surface) { + Plane plane = getPlane(); + return plane.contains(surface); + } /** *************** *** 190,194 **** silhouette.clear(); Collection<Vertex> res = new ArrayList<Vertex>(); ! Plane plan = cs.plane(); Iterator it = edges.iterator(); while (it.hasNext()) { --- 195,199 ---- silhouette.clear(); Collection<Vertex> res = new ArrayList<Vertex>(); ! Plane plan = system.plane(); Iterator it = edges.iterator(); while (it.hasNext()) { *************** *** 198,203 **** res.add(v); } ! Vertex transTo = cs.translate(e.getTo()); ! Vertex transFrom = cs.translate(e.getFrom()); if (Math.abs(transTo.getZ()) < 0.00001 && Math.abs(transFrom.getZ()) < 0.00001) { --- 203,208 ---- res.add(v); } ! Vertex transTo = system.translate(e.getTo()); ! Vertex transFrom = system.translate(e.getFrom()); if (Math.abs(transTo.getZ()) < 0.00001 && Math.abs(transFrom.getZ()) < 0.00001) { *************** *** 359,363 **** } else if (a.getName().equals("Flip")) { if ((Boolean)a.getValue() == Boolean.TRUE) { ! cs.flip(); } } else { --- 364,368 ---- } else if (a.getName().equals("Flip")) { if ((Boolean)a.getValue() == Boolean.TRUE) { ! system.flip(); } } else { *************** *** 409,413 **** */ public CoordinateSystem getCoordinateSystem() { ! return cs; } --- 414,418 ---- */ public CoordinateSystem getCoordinateSystem() { ! return system; } *************** *** 416,420 **** */ public void setCoordinateSystem(CoordinateSystem cs) { ! this.cs = cs; } } --- 421,425 ---- */ public void setCoordinateSystem(CoordinateSystem cs) { ! this.system = cs; } } |