[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool PencilTool.java,1.6,1.7
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-08-31 08:34:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20077/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Refractoring of ray-plane intersection code using new constructors for Vertex and Edge Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PencilTool.java 31 Aug 2005 08:03:32 -0000 1.6 --- PencilTool.java 31 Aug 2005 08:33:55 -0000 1.7 *************** *** 90,95 **** protected void pressed(MouseEvent e) { super.pressed(e); ! int x = e.getX(); ! int y = e.getY(); View v = glv.getView(); Transformation transformation = v.transformation(); --- 90,95 ---- protected void pressed(MouseEvent e) { super.pressed(e); ! double x = e.getX(); ! double y = AbstractView.getHeight() - e.getY(); View v = glv.getView(); Transformation transformation = v.transformation(); *************** *** 98,112 **** } else { Plane xy = new Plane(0, 0, 1, 0); ! Vertex near = new Vertex("near"); ! near.setX(x); ! near.setY(AbstractView.getHeight() - y); ! near.setZ(0.0); ! Vertex far = new Vertex("far"); ! far.setX(x); ! far.setY(AbstractView.getHeight() - y); ! far.setZ(1.0); ! Edge ray = new Edge("ray"); ! ray.setFrom(near); ! ray.setTo(far); ray = transformation.unProject(ray); Vertex vertex = xy.intersection(ray); --- 98,104 ---- } else { Plane xy = new Plane(0, 0, 1, 0); ! Vertex near = new Vertex("near", x, y, 0.0); ! Vertex far = new Vertex("far", x, y, 1.0); ! Edge ray = new Edge("ray", near, far); ray = transformation.unProject(ray); Vertex vertex = xy.intersection(ray); |