Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ExtrusionTool.java, 1.49, 1.50 AltMov
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2007-03-01 14:54:38
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15680/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrusionTool.java AltMoveTool.java PanStrategy.java Log Message: Experimenting with move-interaction Index: AltMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltMoveTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AltMoveTool.java 28 Feb 2007 15:25:52 -0000 1.1 --- AltMoveTool.java 1 Mar 2007 14:53:56 -0000 1.2 *************** *** 10,15 **** --- 10,26 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.LinkedList; + import java.util.List; 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; + import net.sourceforge.bprocessor.model.CoordinateSystem; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 18,21 **** --- 29,36 ---- public class AltMoveTool extends AbstractPencil { + private Surface surface; + private CoordinateSystem system; + private Plane dragplane; + /** * @param glv GLView *************** *** 29,33 **** @Override protected void moved(MouseEvent e) { ! } --- 44,66 ---- @Override protected void moved(MouseEvent e) { ! List<Edge> edges = new LinkedList<Edge>(); ! if (system == null) { ! findTarget(e, View.OBJECTS); ! glv.getView().makeTarget(target); ! } else { ! Vertex hit = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); ! current = new Intersection(hit, Intersection.SURFACE, null); ! Vertex from = start.vertex(); ! Vertex delta = hit.minus(from); ! Vertex normal = system.getN().copy(); ! double distance = normal.dot(delta); ! normal.scale(distance); ! Vertex to = from.add(normal); ! makeTarget(current); ! Edge edge = new Edge(from, to); ! edge.setStrippled(true); ! edges.add(edge); ! } ! feedback(edges); } *************** *** 35,39 **** @Override protected void pressed(MouseEvent e) { ! System.out.println("Alternative Moving!"); } } --- 68,112 ---- @Override protected void pressed(MouseEvent e) { ! if (system == null) { ! System.out.println("Alternative Moving!"); ! findTarget(e, View.OBJECTS); ! glv.getView().makeTarget(target); ! if (target instanceof Surface) { ! System.out.println(" Surface"); ! surface = (Surface) target; ! Selection.primary().set(surface); ! system = surface.coordinateSystem(); ! system.onlyPlane(true); ! system.setActive(true); ! start = findIntersection(e); ! makeTarget(start); ! glv.getView().addTempConstructor(system); ! ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = e.getX(); ! double y = View.getHeight() - e.getY(); ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! Plane plane = system.plane(); ! dragplane = plane.orthogonalPlane(ray); ! } ! } else { ! System.out.println("clean up."); ! cleanUp(); ! moved(e); ! } ! } ! ! /** {@inheritDoc} */ ! @Override ! public void cleanUp() { ! glv.getView().removeTempConstructor(system); ! surface = null; ! system = null; ! Selection.primary().clear(); ! super.cleanUp(); } } Index: PanStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PanStrategy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PanStrategy.java 26 Nov 2006 22:15:15 -0000 1.2 --- PanStrategy.java 1 Mar 2007 14:53:56 -0000 1.3 *************** *** 75,84 **** } double d = -dx * center[0] - dy * center[1] - dz * center[2]; ! Vertex first = view.toPlaneCoords(new double[] {x, ! y}, ! new Plane(dx, dy, dz, d)); ! Vertex second = view.toPlaneCoords(new double[] {e.getX(), ! e.getY()}, ! new Plane(dx, dy, dz, d)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), --- 75,83 ---- } double d = -dx * center[0] - dy * center[1] - dz * center[2]; ! Vertex first = view.toPlaneCoords(x, y, ! new Plane(dx, dy, dz, d)); ! Vertex second = view.toPlaneCoords(e.getX(), ! e.getY(), ! new Plane(dx, dy, dz, d)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** ExtrusionTool.java 19 Feb 2007 15:47:43 -0000 1.49 --- ExtrusionTool.java 1 Mar 2007 14:53:56 -0000 1.50 *************** *** 172,176 **** } else { // a extrudesurface have been chosen ! to = glv.getView().toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); Vertex normal = extrudesurface.normal(); //a bit cleanup --- 172,176 ---- } else { // a extrudesurface have been chosen ! to = glv.getView().toPlaneCoords(e.getX(), e.getY(), dragplane); Vertex normal = extrudesurface.normal(); //a bit cleanup *************** *** 263,267 **** Plane plane = extrudesurface.plane(); dragplane = plane.orthogonalPlane(ray); ! from = view.toPlaneCoords(new double[] {startx, starty}, dragplane); all = !e.isAltDown(); } --- 263,267 ---- Plane plane = extrudesurface.plane(); dragplane = plane.orthogonalPlane(ray); ! from = view.toPlaneCoords(startx, starty, dragplane); all = !e.isAltDown(); } |