Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MultiExtrudeTool.java, 1.19, 1.20 Abs
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-07-20 13:46:47
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9096/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java AbstractPencil.java Log Message: Improved shift-locking in AbstractPencil Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** AbstractPencil.java 20 Jul 2006 11:33:16 -0000 1.46 --- AbstractPencil.java 20 Jul 2006 13:46:42 -0000 1.47 *************** *** 23,26 **** --- 23,27 ---- 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; *************** *** 73,77 **** /** Locked */ ! protected Vertex locked; /** Whether or not the tool is locked */ --- 74,78 ---- /** Locked */ ! protected Edge locked; /** Whether or not the tool is locked */ *************** *** 118,123 **** if (!constrain) { if (current.type() == Intersection.EDGE) { ! locked = start.vertex().minus(current.vertex()); ! locked.normalize(); } else { locked = null; --- 119,123 ---- if (!constrain) { if (current.type() == Intersection.EDGE) { ! locked = (Edge) current.object(); } else { locked = null; *************** *** 125,139 **** } } Collection unwanted = new HashSet(); unwanted.addAll(elements); unwanted.addAll(excluded); ! Intersection intersection = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! unwanted, true, plane); if (constrain && locked != null) { ! intersection = lockedIntersection(intersection); ! } return intersection; } --- 125,162 ---- } } + Plane work = plane; + + Intersection intersection = null; + Transformation transformation = glv.getView().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 = transformation.unProject(ray); + if (constrain && locked != null) { + Vertex v1 = locked.getDirection(); + Vertex v2 = ray.getDirection(); + Vertex v3 = v1.cross(v2); + Vertex normal = v1.cross(v3); + normal.normalize(); + double d = -(locked.center().dot(normal)); + work = new Plane(normal.getX(), normal.getY(), normal.getZ(), d); + } + Collection unwanted = new HashSet(); unwanted.addAll(elements); unwanted.addAll(excluded); ! intersection = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! unwanted, true, work); ! if (constrain && locked != null) { ! Vertex vertex = locked.intersection(intersection.vertex()); ! intersection = new Intersection(vertex, Intersection.EDGE, locked); ! } return intersection; } *************** *** 145,153 **** */ private Intersection lockedIntersection(Intersection intersection) { ! if (start != null) { ! Vertex direction = locked.copy(); ! Vertex unlocked = intersection.vertex().minus(start.vertex()); ! direction.scale(locked.dot(unlocked)); ! Vertex vertex = start.vertex().add(direction); return new Intersection(vertex, intersection.type(), intersection.object()); } else { --- 168,173 ---- */ private Intersection lockedIntersection(Intersection intersection) { ! if (locked != null) { ! Vertex vertex = locked.intersection(intersection.vertex()); return new Intersection(vertex, intersection.type(), intersection.object()); } else { Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MultiExtrudeTool.java 24 May 2006 19:37:33 -0000 1.19 --- MultiExtrudeTool.java 20 Jul 2006 13:46:42 -0000 1.20 *************** *** 105,110 **** normal.scale(-1); log.info("Length of normal: " + normal.length()); ! lock = true; ! locked = normal; Transformation trans = glv.getView().transformation(); double x = e.getX(); --- 105,110 ---- normal.scale(-1); log.info("Length of normal: " + normal.length()); ! //lock = true; ! //locked = normal; Transformation trans = glv.getView().transformation(); double x = e.getX(); |