[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool FinalMoveTool.java, 1.18, 1.19 Abstra
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-09-04 13:37:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25516/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java AbstractPencil.java Log Message: experimenting with hitdetection Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** FinalMoveTool.java 30 Aug 2007 13:57:46 -0000 1.18 --- FinalMoveTool.java 4 Sep 2007 13:37:18 -0000 1.19 *************** *** 69,81 **** Map<Vertex, Direction> slidemap = new HashMap(); Map<Vertex, Collection<Edge>> edgemap = space.edgeMap(vertices); - System.out.println("-- map --"); for (Vertex current : vertices) { Collection<Edge> edges = edgemap.get(current); Direction direction; if (edges.size() == 0) { - System.out.println(" free"); direction = new Direction(current.copy(), null); } else if (edges.size() == 1) { - System.out.println(" constrained"); Edge edge = edges.iterator().next(); Vertex to = edge.otherVertex(current); --- 69,78 ---- *************** *** 85,89 **** direction = new Direction(current.copy(), v, Double.NEGATIVE_INFINITY, length); } else { - System.out.println(" bound"); direction = new Direction(current.copy(), null, 0, 0); } --- 82,85 ---- Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** AbstractPencil.java 3 Sep 2007 11:31:34 -0000 1.90 --- AbstractPencil.java 4 Sep 2007 13:37:18 -0000 1.91 *************** *** 156,168 **** boolean constrain = lock || e.isShiftDown(); ! if (start != null) { ! Vertex planeNormal = plane.normal(); ! plane = new Plane(planeNormal.getX(), ! planeNormal.getY(), ! planeNormal.getZ(), ! -(planeNormal.getX() * start.vertex().getX() + ! planeNormal.getY() * start.vertex().getY() + ! planeNormal.getZ() * start.vertex().getZ())); ! } if (current != null) { if (!constrain) { --- 156,160 ---- boolean constrain = lock || e.isShiftDown(); ! if (current != null) { if (!constrain) { *************** *** 181,185 **** } } ! Plane work = plane; Intersection intersection = null; --- 173,177 ---- } } ! Intersection intersection = null; *************** *** 193,196 **** --- 185,211 ---- ray = transformation.unProject(ray); + { + Vertex n = new Vertex(0, 0, 1.0); + n = transformation.unProject(n); + n.normalize(); + if (start != null) { + Vertex planeNormal; + if (Math.abs(n.getZ()) < 0.45) { + planeNormal = plane.normal(); + } else { + planeNormal = plane.normal(); + } + plane = new Plane(planeNormal.getX(), + planeNormal.getY(), + planeNormal.getZ(), + -(planeNormal.getX() * start.vertex().getX() + + planeNormal.getY() * start.vertex().getY() + + planeNormal.getZ() * start.vertex().getZ())); + + } + } + + Plane work = plane; + if (constrain) { if (lockingEdge != null) { *************** *** 214,217 **** --- 229,233 ---- unwanted.add(lockSnapVertex); } + intersection = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), |