[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.190, 1.191
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2007-03-04 23:34:24
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10265/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Improved hitdetection of surface/edge intersections slightly. Fixed problem with overlarge CoordinateSystems in hitdetection. Implemented an alternative movetool that is an experiment in moving vertices to a plane, sliding on binding edges. Started implementation of relations, that contains an offset in the form of an expression. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.190 retrieving revision 1.191 diff -C2 -d -r1.190 -r1.191 *** View.java 1 Mar 2007 14:53:56 -0000 1.190 --- View.java 4 Mar 2007 23:14:40 -0000 1.191 *************** *** 515,518 **** --- 515,526 ---- return lastSurface; } + + /** + * + * @param surface Surface + */ + public static void setLastSurface(Surface surface) { + lastSurface = surface; + } /** *************** *** 900,904 **** } ! drawSpace(Project.getInstance().world(), false); //Draw edges --- 908,912 ---- } ! drawSpace(Project.getInstance().world(), false, false); //Draw edges *************** *** 1058,1066 **** * @param space The Space * @param active inside active space */ ! private void drawSpace(Space space, boolean active) { if (space == Project.getInstance().getActiveSpace()) { active = true; } gl.glPushMatrix(); transform(space.getTransformations()); --- 1066,1079 ---- * @param space The Space * @param active inside active space + * @param selected inside selected space */ ! private void drawSpace(Space space, boolean active, boolean selected) { if (space == Project.getInstance().getActiveSpace()) { active = true; } + Collection<Geometric> selection = Selection.primary(); + if (selection.contains(space)) { + selected = true; + } gl.glPushMatrix(); transform(space.getTransformations()); *************** *** 1106,1110 **** while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, active); } gl.glPopMatrix(); --- 1119,1123 ---- while (iter.hasNext()) { Space current = (Space) iter.next(); ! drawSpace(current, active, selected); } gl.glPopMatrix(); *************** *** 2030,2037 **** { Camera camera = Project.getInstance().getCurrentCamera(); ! Vertex v = new Vertex(camera.getCamera()); ! double scale = (camera.getFocalwidth() / 65) * (500 / height); ! double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! Collection all = new LinkedList(); all.addAll(space.getConstructors()); --- 2043,2047 ---- { Camera camera = Project.getInstance().getCurrentCamera(); ! Collection all = new LinkedList(); all.addAll(space.getConstructors()); *************** *** 2042,2046 **** while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); ! if (!excluded.contains(current)) { if (current.getOwner() != owner) { --- 2052,2056 ---- while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); ! double dist = camera.distance(current.getOrigin()); if (!excluded.contains(current)) { if (current.getOwner() != owner) { *************** *** 2050,2056 **** transformTo(owner); } - if (camera.getType() == Camera.PERSPECTIVE) { - dist = (current.getOrigin().minus(v)).length() * scale; - } if (selectionMode == INTERSECTIONS) { if (current.isEditable()) { --- 2060,2063 ---- *************** *** 2510,2514 **** // into empty space. if (object == null && vertex == null && edge == null) { ! lastSurface = surface; } --- 2517,2521 ---- // into empty space. if (object == null && vertex == null && edge == null) { ! setLastSurface(surface); } *************** *** 2518,2522 **** // into empty space. if (lastSurface == null) { ! lastSurface = surface; } --- 2525,2529 ---- // into empty space. if (lastSurface == null) { ! setLastSurface(surface); } *************** *** 2630,2633 **** --- 2637,2653 ---- if (surface != null) { Plane plane = surface.plane(); + for (Edge current : (Collection<Edge>) edges) { + Vertex intersection = plane.intersection(current); + if (intersection != null) { + Vertex projected = transformation.project(intersection); + double dx = x - projected.getX(); + double dy = (height - y) - projected.getY(); + double distance = Math.sqrt(dx * dx + dy * dy); + if (distance < 5) { + return new Intersection(intersection, + Intersection.SURFACE_INTERSECTION, surface); + } + } + } Vertex intersection = plane.intersection(ray); return new Intersection(intersection, Intersection.SURFACE, surface); |