[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MoveTool.java,1.10,1.11 ExtrusionTool.
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2005-09-16 13:01:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3731/tool Modified Files: MoveTool.java ExtrusionTool.java Log Message: Length measurements added Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MoveTool.java 8 Sep 2005 10:50:09 -0000 1.10 --- MoveTool.java 16 Sep 2005 13:01:04 -0000 1.11 *************** *** 40,43 **** --- 40,46 ---- private int moveMode = XY; + /** The initial movepoint */ + private Vertex initial; + /** The previous X coordinate */ private int previousX = 0; *************** *** 68,71 **** --- 71,75 ---- if (target != null) { dragPlane = findMovePlane(); + initial = glv.getView().toPlaneCoords(new double[] {previousX, previousY}, dragPlane); } log.info("plane: " + dragPlane); *************** *** 88,92 **** // make a orthogonal plane to the current one if (moveMode == XZ) { - log.info("ortho"); Transformation trans = glv.getView().transformation(); int x = previousX; --- 92,95 ---- *************** *** 108,111 **** --- 111,115 ---- super.released(e); + initial = null; dragPlane = null; } *************** *** 121,135 **** View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! double[] to = view.toPlaneCoords(new double[] {x, y}, dragPlane); ! double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; if (log.isDebugEnabled()) { ! log.debug("from " + from[0] + ", " + from[1] + ", " + from[2]); ! log.debug("to " + to[0] + ", " + to[1] + ", " + to[2]); ! log.debug("delta " + delta[0] + ", " + delta[1] + ", " + delta[2]); } move(selection, delta); ! } else { ! log.warn("There were no plane to drag according to"); } --- 125,138 ---- View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! Vertex to = view.toPlaneCoords(new double[] {x, y}, dragPlane); ! Vertex delta = to.minus(from); if (log.isDebugEnabled()) { ! log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); ! log.debug("to " + to.getX() + ", " + to.getY() + ", " + to.getZ()); ! log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } move(selection, delta); ! glv.setLength(to.minus(initial).length()); } *************** *** 143,156 **** * @param delta The movement */ ! private void move(List sel, double[] delta) { Iterator it = sel.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Vertex) { ! ((Vertex)elm).move(delta[0], delta[1], delta[2]); } else if (elm instanceof Edge) { ! ((Edge)elm).move(delta[0], delta[1], delta[2]); } else if (elm instanceof Surface) { ! ((Surface) elm).move(delta[0], delta[1], delta[2]); } } --- 146,159 ---- * @param delta The movement */ ! private void move(List sel, Vertex delta) { Iterator it = sel.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Vertex) { ! ((Vertex)elm).move(delta.getX(), delta.getY(), delta.getZ()); } else if (elm instanceof Edge) { ! ((Edge)elm).move(delta.getX(), delta.getY(), delta.getZ()); } else if (elm instanceof Surface) { ! ((Surface) elm).move(delta.getX(), delta.getY(), delta.getZ()); } } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ExtrusionTool.java 14 Sep 2005 14:11:36 -0000 1.10 --- ExtrusionTool.java 16 Sep 2005 13:01:04 -0000 1.11 *************** *** 50,53 **** --- 50,56 ---- private int prevY; + /** The extrusion edge */ + private Edge extrusion; + /** * The Constructor *************** *** 76,85 **** normal.scale(1 / normal.length()); View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {prevX, prevY}, dragplane); ! double[] to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); ! double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! double normDotDelta = ((normal.getX() * delta[0]) + ! (normal.getY() * delta[1]) + ! (normal.getZ() * delta[2])); normal.scale(normDotDelta / (normal.length() * normal.length())); //normal.scale(delta); --- 79,86 ---- normal.scale(1 / normal.length()); View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {prevX, prevY}, dragplane); ! Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); ! Vertex delta = to.minus(from); ! double normDotDelta = normal.dot(delta); normal.scale(normDotDelta / (normal.length() * normal.length())); //normal.scale(delta); *************** *** 107,110 **** --- 108,114 ---- } } + if (extrusion != null) { + glv.setLength(extrusion.getLength()); + } } } *************** *** 132,135 **** --- 136,140 ---- Edge e = (Edge)it.next(); if (!s.contains(e)) { + extrusion = e; Vertex v1 = e.otherVertex(v); Vertex v2 = v1.minus(v); *************** *** 155,158 **** --- 160,164 ---- prevX = e.getX(); prevY = e.getY(); + if (target instanceof Surface) { Surface selectedSurface = (Surface)target; *************** *** 176,179 **** --- 182,186 ---- super.released(e); dragSurface = null; + extrusion = null; } *************** *** 217,220 **** --- 224,230 ---- previousEdge = tonfrom; previousVertex = newFrom; + + // used for measuring the length of the extrusion + extrusion = ntofrom; } else { if (times == edges.size() - 1 && |