[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Surface.java,1.54,1.55
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-12-16 15:53:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31491/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Fixed bug in Surface.surrounds() Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** Surface.java 12 Dec 2005 20:18:52 -0000 1.54 --- Surface.java 16 Dec 2005 15:53:34 -0000 1.55 *************** *** 283,286 **** --- 283,289 ---- getEdges().toArray(edges); + // FIXME Generalize to + // replace one edge with list of edges. + for (int i = 0; i < edges.length; i++) { Edge current = edges[i]; *************** *** 862,873 **** this surface */ - if (lv.getZ() > planePrecision || -lv.getZ() > planePrecision) { return false; } else { ! /* ! The crossing numbers algorithm but simplyfied by translating ! points to the local coordinates of the surface plane. ! */ Iterator ei = edges.iterator(); int count = 0; --- 865,875 ---- this surface */ if (lv.getZ() > planePrecision || -lv.getZ() > planePrecision) { return false; } else { ! // Crossing numbers algorithm in 2d by translating to plane ! // TODO a cheaper way to translate is to discard a component of the vertices ! // Ñ the component that corresponds to the component of the normal with largest ! // absolute value to ensure that the translated surface has a non-zero area. Iterator ei = edges.iterator(); int count = 0; *************** *** 877,891 **** Vertex f = cs.translate(e.getFrom()); boolean cross = false; ! if (t.getY() > lv.getY() && ! f.getY() < lv.getY()) { cross = true; ! } else if (t.getY() < lv.getY() && ! f.getY() > lv.getY()) { cross = true; } ! /* ! Making sure only to count crossings to the right ! of v. ! */ if (cross) { Vertex dir = t.minus(f); --- 879,892 ---- Vertex f = cs.translate(e.getFrom()); boolean cross = false; ! if (f.getY() <= lv.getY() && ! lv.getY() < t.getY()) { cross = true; ! } else if (t.getY() <= lv.getY() && ! lv.getY() < f.getY()) { cross = true; } ! ! // Making sure only to count crossings to the right ! // of v if (cross) { Vertex dir = t.minus(f); *************** *** 896,899 **** --- 897,901 ---- cross = (pstar > 0); } + } if (cross) { *************** *** 901,904 **** --- 903,907 ---- } } + return !(count % 2 == 0); } |