[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Edge.java, 1.67, 1.68
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Nordholt <nor...@us...> - 2006-12-29 15:18:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6663/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: fixing offset directions calculation when two edges who share a vertex are parallel. Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Edge.java 18 Dec 2006 18:17:39 -0000 1.67 --- Edge.java 29 Dec 2006 15:17:59 -0000 1.68 *************** *** 651,655 **** * in order to make an offset. The amount each edge should be offset is given in * an offset map, from an edge to a double value. The edges must all belong to ! * the same surface. * @param which the edges to offset * @param inner the surface the edges belong to --- 651,655 ---- * in order to make an offset. The amount each edge should be offset is given in * an offset map, from an edge to a double value. The edges must all belong to ! * the same surface. * @param which the edges to offset * @param inner the surface the edges belong to *************** *** 677,703 **** while (!done) { work = commonVertex(e1, e2); if (which.contains(e1) || which.contains(e2)) { Vertex dir1 = work.minus(e1.otherVertex(work)); Vertex dir2 = e2.otherVertex(work).minus(work); ! Vertex org1 = new Vertex(0, 0, 0); ! Vertex org2 = new Vertex(0, 0, 0);; ! if (which.contains(e1)) { ! org1 = dir1.cross(normal); ! org1.normalize(); ! org1.scale(((Double)offsetMap.get(e1)).doubleValue()); ! } ! if (which.contains(e2)) { ! org2 = dir2.cross(normal); ! org2.normalize(); ! org2.scale(((Double)offsetMap.get(e2)).doubleValue()); ! } ! org1 = org1.add(work); ! org2 = org2.add(work); ! Line l1 = new Line(org1, dir1); ! Line l2 = new Line(org2, dir2); ! Vertex mainDir = work.minus(l1.intersection(l2)); v2Dir.put(work, mainDir); - e1 = e2; if (edges2.hasNext()) { --- 677,716 ---- while (!done) { work = commonVertex(e1, e2); + Vertex mainDir; if (which.contains(e1) || which.contains(e2)) { Vertex dir1 = work.minus(e1.otherVertex(work)); Vertex dir2 = e2.otherVertex(work).minus(work); ! if (dir1.cross(dir2).length() > 0.00001) { ! Vertex org1 = new Vertex(0, 0, 0); ! Vertex org2 = new Vertex(0, 0, 0); ! if (which.contains(e1)) { ! org1 = dir1.cross(normal); ! org1.normalize(); ! org1.scale(((Double)offsetMap.get(e1)).doubleValue()); ! } ! if (which.contains(e2)) { ! org2 = dir2.cross(normal); ! org2.normalize(); ! org2.scale(((Double)offsetMap.get(e2)).doubleValue()); ! } ! org1 = org1.add(work); ! org2 = org2.add(work); ! Line l1 = new Line(org1, dir1); ! Line l2 = new Line(org2, dir2); ! mainDir = work.minus(l1.intersection(l2)); ! } else { ! //If the edges are parallel the offset must be the same ! mainDir = dir1.cross(normal); ! mainDir.normalize(); ! double scale; ! if (offsetMap.keySet().contains(e1)) { ! scale = ((Double)offsetMap.get(e1)).doubleValue(); ! } else { ! scale = ((Double)offsetMap.get(e2)).doubleValue(); ! } ! mainDir.scale(scale); ! } v2Dir.put(work, mainDir); e1 = e2; if (edges2.hasNext()) { |