[Bprocessor-commit] /gl/src/net/sourceforge/bprocessor/gl/tool FinalMoveTool.java, 1.46, 1.47 Abstr
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-12-18 23:41:32
|
Update of /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17298/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java AbstractPencil.java Log Message: improved on instance move, to be able to place instances in a abitrary coordinatesystem and better insert plane alignment Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** FinalMoveTool.java 17 Dec 2007 19:59:43 -0000 1.46 --- FinalMoveTool.java 18 Dec 2007 23:41:36 -0000 1.47 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.gl.Editor; 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.gui.GUI; *************** *** 207,215 **** this.instance = instance; this.initialCoordinate = instance.getInstanceAnchor().copy(); ! this.handle = handle; ! Vertex center = this.initialCoordinate.translate(this.handle.center()); start = new Intersection(center, start.type(), start.object()); this.prevCs = Project.getInstance().getActiveCoordinateSystem().copy(); this.prevCs.setOrigin(center); } --- 208,228 ---- this.instance = instance; this.initialCoordinate = instance.getInstanceAnchor().copy(); ! this.handle = handle.copy(); ! Transformation transformation = editor.getView().transformation(); ! double x = pressPos[0]; ! double y = View.getHeight() - pressPos[1]; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = transformation.unProject(ray); ! CoordinateSystem tmp = this.initialCoordinate.unTranslate(this.handle); ! Vertex center = tmp.plane().intersection(ray); start = new Intersection(center, start.type(), start.object()); + + center = this.initialCoordinate.translate(center); + this.handle.setOrigin(center); this.prevCs = Project.getInstance().getActiveCoordinateSystem().copy(); this.prevCs.setOrigin(center); + } *************** *** 229,235 **** cs = CoordinateSystem.systemFor(current.vertex(), n); } else if (current.object() instanceof Plane) { Plane p = (Plane)current.object(); Vertex normal = p.normal(); ! cs = CoordinateSystem.systemFor(current.vertex(), normal); } if (cs == null) { --- 242,256 ---- cs = CoordinateSystem.systemFor(current.vertex(), n); } else if (current.object() instanceof Plane) { + Transformation transformation = editor.getView().transformation(); + double x = pressPos[0] + dx; + double y = View.getHeight() - pressPos[1] - dy; + Vertex near = new Vertex(x, y, 0.0); + Vertex far = new Vertex(x, y, 1.0); + Edge ray = new Edge(near, far); + ray = transformation.unProject(ray); + Vertex cen = Project.getInstance().getActiveCoordinateSystem().plane().intersection(ray); Plane p = (Plane)current.object(); Vertex normal = p.normal(); ! cs = CoordinateSystem.systemFor(cen, normal); } if (cs == null) { *************** *** 239,243 **** prevCs = cs; } ! CoordinateSystem tmp = handle.translate(Project.getInstance().getActiveCoordinateSystem()); tmp = cs.unTranslate(tmp); instance.getInstanceAnchor().setOrigin(tmp.center()); --- 260,266 ---- prevCs = cs; } ! CoordinateSystem zero = new CoordinateSystem(new Vertex(1, 0, 0), new Vertex(0, 1, 0), ! new Vertex(0, 0, 1), new Vertex(0, 0, 0)); ! CoordinateSystem tmp = handle.translate(zero); tmp = cs.unTranslate(tmp); instance.getInstanceAnchor().setOrigin(tmp.center()); Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor//gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** AbstractPencil.java 13 Dec 2007 12:00:49 -0000 1.102 --- AbstractPencil.java 18 Dec 2007 23:41:36 -0000 1.103 *************** *** 188,192 **** if (start != null) { Vertex normal; ! if (Math.abs(n.getZ()) > 0.47) { normal = new Vertex(0, 0, 1.0); } else { --- 188,192 ---- if (start != null) { Vertex normal; ! /*if (Math.abs(n.getZ()) > 0.47) { normal = new Vertex(0, 0, 1.0); } else { *************** *** 194,198 **** d.normalize(); normal = d; ! } normal = Project.getInstance().getActiveCoordinateSystem().getN(); --- 194,198 ---- d.normalize(); normal = d; ! }*/ normal = Project.getInstance().getActiveCoordinateSystem().getN(); |