[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool PencilTool.java,1.62,1.63 MoveTool.jav
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-03-10 16:41:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10207/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java MoveTool.java ToolFactory.java TapeMeasureTool.java MultiExtrudeTool.java Log Message: MultiExtrusionTool now used Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** MoveTool.java 7 Mar 2006 22:31:04 -0000 1.43 --- MoveTool.java 10 Mar 2006 16:41:25 -0000 1.44 *************** *** 175,179 **** controlled = (Entity)it.next(); } ! selection = new HashSet(); selection.add(controlled); } --- 175,179 ---- controlled = (Entity)it.next(); } ! selection.clear(); selection.add(controlled); } *************** *** 373,377 **** delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! Object o = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, false); if (o != null) { snapEntity = (Entity)o; --- 373,378 ---- delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! Object o = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, ! false, new Plane(0, 0, 1, 0)); if (o != null) { snapEntity = (Entity)o; Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ToolFactory.java 15 Feb 2006 11:27:48 -0000 1.31 --- ToolFactory.java 10 Mar 2006 16:41:25 -0000 1.32 *************** *** 184,188 **** move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); ! extrusion = new ExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); --- 184,188 ---- move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); ! extrusion = new MultiExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** PencilTool.java 7 Mar 2006 22:31:04 -0000 1.62 --- PencilTool.java 10 Mar 2006 16:41:25 -0000 1.63 *************** *** 94,125 **** int y = event.getY(); View view = glv.getView(); ! Intersection intersection = (Intersection) view.getObjectAtPoint(x, y, new HashSet(), true); ! current = intersection.vertex(); ! switch (intersection.type()) { ! case Intersection.VERTEX: ! target = current; ! setSnapVertex(current); ! break; ! case Intersection.EDGE: ! target = intersection.object(); ! break; ! case Intersection.SURFACE: ! target = intersection.object(); ! break; ! case Intersection.EDGE_MIDPOINT: ! target = current; ! setSnapVertex(current); ! break; ! case Intersection.EDGE_INTERSECTION: ! target = current; ! break; ! case Intersection.SURFACE_INTERSECTION: ! target = current; ! break; ! case Intersection.PLANE_INTERSECTION: ! target = null; ! break; } - view.makeTarget(target); } --- 94,128 ---- int y = event.getY(); View view = glv.getView(); ! Intersection intersection ! = (Intersection) view.getObjectAtPoint(x, y, new HashSet(), true, new Plane(0, 0, 1, 0)); ! if (intersection != null) { ! current = intersection.vertex(); ! switch (intersection.type()) { ! case Intersection.VERTEX: ! target = current; ! setSnapVertex(current); ! break; ! case Intersection.EDGE: ! target = intersection.object(); ! break; ! case Intersection.SURFACE: ! target = intersection.object(); ! break; ! case Intersection.EDGE_MIDPOINT: ! target = current; ! setSnapVertex(current); ! break; ! case Intersection.EDGE_INTERSECTION: ! target = current; ! break; ! case Intersection.SURFACE_INTERSECTION: ! target = current; ! break; ! case Intersection.PLANE_INTERSECTION: ! target = null; ! break; ! } ! view.makeTarget(target); } } Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TapeMeasureTool.java 1 Mar 2006 11:16:17 -0000 1.10 --- TapeMeasureTool.java 10 Mar 2006 16:41:25 -0000 1.11 *************** *** 191,196 **** if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = true; ! measuring = false; Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); --- 191,196 ---- if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = false; ! measuring = true; Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MultiExtrudeTool.java 7 Mar 2006 16:45:20 -0000 1.6 --- MultiExtrudeTool.java 10 Mar 2006 16:41:25 -0000 1.7 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; *************** *** 37,40 **** --- 38,44 ---- private static Logger log = Logger.getLogger(MultiExtrudeTool.class); + /** Point based snapping? */ + private static final boolean SNAPPING = false; + /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; *************** *** 115,121 **** View view = glv.getView(); Vertex from = view.toPlaneCoords(new double[] {pressX, pressY}, dragPlane); ! Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); if (direction == 0) { //we have never set the direction; --- 119,146 ---- View view = glv.getView(); Vertex from = view.toPlaneCoords(new double[] {pressX, pressY}, dragPlane); ! Vertex to; ! if (SNAPPING) { ! Set ignore = new HashSet(); ! if (elements != null) { ! ignore.addAll(elements); ! } ! ignore.add(extrudeSurface); ! ignore.addAll(extrudeSurface.getEdges()); ! Intersection intersection = ! (Intersection) view.getObjectAtPoint(e.getX(), e.getY(), ignore, true, dragPlane); ! if (intersection == null || intersection.type() == Intersection.SURFACE) { ! to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); ! } else { ! to = intersection.vertex(); ! } ! } else { ! to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); ! } Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); + if (Math.abs(normDotDelta) < 0.000001) { + normDotDelta = 0; + } + if (direction == 0) { //we have never set the direction; *************** *** 129,133 **** } } ! if (v2dir != null) { // The extrusion were succesfull move it // Find the move direction --- 154,158 ---- } } ! if (!SNAPPING && v2dir != null) { // The extrusion were succesfull move it // Find the move direction *************** *** 253,256 **** --- 278,282 ---- elements.add(s); } + t = 0; return elements; } |