[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool MoveTool.java,1.26,1.27
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-01-24 12:14:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13385/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java Log Message: Fixed MoveTool to be able to move ClippingPlanes Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** MoveTool.java 18 Jan 2006 11:46:50 -0000 1.26 --- MoveTool.java 24 Jan 2006 12:14:39 -0000 1.27 *************** *** 113,117 **** clearConstructors(moveConstructors); if (target != null) { ! initial = findInitial((Entity)target, e); from = initial.copy(); --- 113,117 ---- clearConstructors(moveConstructors); if (target != null) { ! initial = findInitial(target, e); from = initial.copy(); *************** *** 142,150 **** /** * Finds the initial point clicked for movement. ! * @param ent the entity initialy clicked * @param e the mouse event associated with the click. * @return the initial point of movement. */ ! protected Vertex findInitial(Entity ent, MouseEvent e) { double x = e.getX(); double y = View.getHeight() - e.getY(); --- 142,150 ---- /** * Finds the initial point clicked for movement. ! * @param entity the entity initialy clicked * @param e the mouse event associated with the click. * @return the initial point of movement. */ ! protected Vertex findInitial(Object entity, MouseEvent e) { double x = e.getX(); double y = View.getHeight() - e.getY(); *************** *** 155,167 **** Edge ray = new Edge(near, far); ray = transformation.unProject(ray); ! if (ent instanceof Vertex) { ! return ((Vertex)ent).copy(); ! } else if (ent instanceof Surface) { ! Plane surfacePlane = ((Surface)ent).plane(); ! return surfacePlane.intersection(ray); ! } else if (ent instanceof Edge) { ! Edge edge = (Edge) ent; Edge intersection = edge.intersection(ray); return intersection.getFrom(); } log.warn("The clicked object is not an Entity"); --- 155,170 ---- Edge ray = new Edge(near, far); ray = transformation.unProject(ray); ! if (entity instanceof Vertex) { ! return ((Vertex)entity).copy(); ! } else if (entity instanceof Surface) { ! Plane plane = ((Surface)entity).plane(); ! return plane.intersection(ray); ! } else if (entity instanceof Edge) { ! Edge edge = (Edge) entity; Edge intersection = edge.intersection(ray); return intersection.getFrom(); + } else if (entity instanceof ClippingPlane) { + Plane plane = ((ClippingPlane) entity).getPlane(); + return plane.intersection(ray); } log.warn("The clicked object is not an Entity"); |