[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool AbstractPencil.java, 1.47, 1.48
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-07-20 14:21:42
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24891/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: Attempt to lock to plane Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** AbstractPencil.java 20 Jul 2006 13:46:42 -0000 1.47 --- AbstractPencil.java 20 Jul 2006 14:21:39 -0000 1.48 *************** *** 73,78 **** protected Edge hooverEdge; ! /** Locked */ ! protected Edge locked; /** Whether or not the tool is locked */ --- 73,82 ---- protected Edge hooverEdge; ! /** Locking Edge */ ! protected Edge lockingEdge; ! ! /** Locking Plane */ ! protected Plane lockingPlane; ! /** Whether or not the tool is locked */ *************** *** 117,125 **** planeNormal.getY() * start.vertex().getY() + planeNormal.getZ() * start.vertex().getZ())); if (!constrain) { if (current.type() == Intersection.EDGE) { ! locked = (Edge) current.object(); ! } else { ! locked = null; } } --- 121,140 ---- planeNormal.getY() * start.vertex().getY() + planeNormal.getZ() * start.vertex().getZ())); + } + if (current != null) { if (!constrain) { + lockingEdge = null; + lockingPlane = null; if (current.type() == Intersection.EDGE) { ! lockingEdge = (Edge) current.object(); ! } ! if (current.type() == Intersection.SURFACE) { ! Surface surface = (Surface) current.object(); ! lockingPlane = surface.plane(); ! Project.info("lock to surface"); ! } ! if (current.type() == Intersection.PLANE_INTERSECTION) { ! Project.info("lock to plane"); ! lockingPlane = (Plane) current.object(); } } *************** *** 138,148 **** ! 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); } --- 153,163 ---- ! if (constrain && lockingEdge != null) { ! Vertex v1 = lockingEdge.getDirection(); Vertex v2 = ray.getDirection(); Vertex v3 = v1.cross(v2); Vertex normal = v1.cross(v3); normal.normalize(); ! double d = -(lockingEdge.center().dot(normal)); work = new Plane(normal.getX(), normal.getY(), normal.getZ(), d); } *************** *** 155,180 **** unwanted, true, work); ! if (constrain && locked != null) { ! Vertex vertex = locked.intersection(intersection.vertex()); ! intersection = new Intersection(vertex, Intersection.EDGE, locked); } return intersection; } /** - * If the tool is locked correct the intersection - * @param intersection the original intersection - * @return the corrected intersection - */ - private Intersection lockedIntersection(Intersection intersection) { - if (locked != null) { - Vertex vertex = locked.intersection(intersection.vertex()); - return new Intersection(vertex, intersection.type(), intersection.object()); - } else { - return intersection; - } - } - - /** * Insert a vertex into model * @param vertex Vertex --- 170,184 ---- unwanted, true, work); ! if (constrain) { ! if (lockingEdge != null) { ! Vertex vertex = lockingEdge.intersection(intersection.vertex()); ! intersection = new Intersection(vertex, Intersection.EDGE, lockingEdge); ! } } + return intersection; } /** * Insert a vertex into model * @param vertex Vertex *************** *** 841,845 **** hooverEdge = null; lock = false; ! locked = null; constructors(new LinkedList()); feedback(new LinkedList()); --- 845,849 ---- hooverEdge = null; lock = false; ! lockingEdge = null; constructors(new LinkedList()); feedback(new LinkedList()); |