[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view AbstractView.java,1.64,1.65 View.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2005-11-30 23:05:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26883/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java View.java Log Message: Penciltool finds intersection when hitting two edges Catmull-Clark has a corner-rule Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** AbstractView.java 30 Nov 2005 15:43:21 -0000 1.64 --- AbstractView.java 30 Nov 2005 23:04:54 -0000 1.65 *************** *** 1104,1108 **** */ private void drawVertexHit(Vertex v) { - // TODO draw a point gl.glPointSize(7.0f); gl.glBegin(GL.GL_POINTS); --- 1104,1107 ---- *************** *** 1110,1118 **** gl.glEnd(); gl.glPointSize(1.0f); - - //gl.glPushMatrix(); - //gl.glTranslated(v.getX(), v.getY(), v.getZ()); - //glu.gluSphere(ball, 0.5, 8, 8); - //gl.glPopMatrix(); } --- 1109,1112 ---- *************** *** 1417,1425 **** /** * Processes the select buffer ! * @return the ID of the closest hit and -1 if no hit. */ ! private Object processSelect() { ! //Processing hits ! // TODO Find vertices int bufferOffset = 0; int names = 0; --- 1411,1418 ---- /** * Processes the select buffer ! * @return the closest hit and null if no hit. */ ! private List processSelect() { ! List selection = new LinkedList(); int bufferOffset = 0; int names = 0; *************** *** 1475,1479 **** if (Math.abs(vLocal.getZ()) < 0.0000000001) { ! return v; } } --- 1468,1473 ---- if (Math.abs(vLocal.getZ()) < 0.0000000001) { ! selection.add(v); ! return selection; } } *************** *** 1489,1521 **** Vertex from = e.getFrom(); Vertex to = e.getTo(); - if (vertices.contains(from)) { - return from; - } - if (vertices.contains(to)) { - return to; - } // Test if from and to are in the same plane as the closest surface Vertex fromLocal = system.translate(from); Vertex toLocal = system.translate(to); ! if ((Math.abs(fromLocal.getZ()) < 0.0000000001) ! && (Math.abs(toLocal.getZ()) < 0.0000000001)) { ! return e; } } } } if (closest instanceof Edge) { Edge edge = (Edge) closest; if (vertices.contains(edge.getFrom())) { ! return edge.getFrom(); } if (vertices.contains(edge.getTo())) { ! return edge.getTo(); } } if (closest instanceof ClippingPlane) { ClippingPlane cp = (ClippingPlane) closest; } ! return closest; } --- 1483,1535 ---- Vertex from = e.getFrom(); Vertex to = e.getTo(); // Test if from and to are in the same plane as the closest surface Vertex fromLocal = system.translate(from); Vertex toLocal = system.translate(to); ! boolean fromIn = (Math.abs(fromLocal.getZ()) < 0.0000000001); ! boolean toIn = (Math.abs(toLocal.getZ()) < 0.0000000001); ! ! if (fromIn && vertices.contains(from)) { ! selection.add(from); ! return selection; ! } ! ! if (toIn && vertices.contains(to)) { ! selection.add(to); ! return selection; ! } ! if (fromIn && toIn) { ! selection.add(e); } } } + if (!selection.isEmpty()) { + return selection; + } } if (closest instanceof Edge) { Edge edge = (Edge) closest; if (vertices.contains(edge.getFrom())) { ! selection.add(edge.getFrom()); ! return selection; } if (vertices.contains(edge.getTo())) { ! selection.add(edge.getTo()); ! return selection; } + selection.add(edge); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Object o = iter.next(); + if (o != edge) { + selection.add(o); + } + } + return selection; } if (closest instanceof ClippingPlane) { ClippingPlane cp = (ClippingPlane) closest; } ! selection.add(closest); ! return selection; } *************** *** 1526,1530 **** * @return The object under the point, null if no object is there */ ! public Object getObjectAtPoint(double x, double y) { int id; this.x = x; --- 1540,1544 ---- * @return The object under the point, null if no object is there */ ! public List getObjectAtPoint(double x, double y) { int id; this.x = x; *************** *** 1537,1543 **** glv.repaint(true); ! Object o = processSelect(); clearNames(); ! return o; } --- 1551,1557 ---- glv.repaint(true); ! List selection = processSelect(); clearNames(); ! return selection; } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** View.java 30 Nov 2005 15:43:20 -0000 1.23 --- View.java 30 Nov 2005 23:04:54 -0000 1.24 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.gl.view; + import java.util.List; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; *************** *** 230,234 **** * @return The object under the point, null if no object is there. */ ! public Object getObjectAtPoint(double x, double y); /** --- 232,236 ---- * @return The object under the point, null if no object is there. */ ! public List getObjectAtPoint(double x, double y); /** |