Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12198/src/net/sourceforge/bprocessor/gl/view
Modified Files:
View.java
Log Message:
Surface.getVertices() no longer returns the first vertex twice
Index: View.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** View.java 1 Feb 2006 10:04:27 -0000 1.55
--- View.java 2 Feb 2006 12:15:04 -0000 1.56
***************
*** 1240,1276 ****
if (vertices.size() > 0) {
Vertex first = (Vertex) vertices.get(0);
! Vertex last = (Vertex) vertices.get(vertices.size() - 1);
! if (first == last) {
! Iterator iter = vertices.iterator();
! glu.gluTessBeginContour(tess);
! while (iter.hasNext()) {
! Vertex current = (Vertex) iter.next();
! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()};
! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2]));
! }
! glu.gluTessEndContour(tess);
! }
! }
! }
!
! /**
! * Draw contour of a Surface in reverse
! * @param surface The surface
! * @param tess The Tesselator
! */
! private void drawContourReverse(Surface surface, GLUtesselator tess) {
! List vertices = surface.getVertices();
! if (vertices.size() > 0) {
! Vertex first = (Vertex) vertices.get(0);
! Vertex last = (Vertex) vertices.get(vertices.size() - 1);
! if (first == last) {
! glu.gluTessBeginContour(tess);
! for (int i = vertices.size(); i > 0; i--) {
! Vertex current = (Vertex) vertices.get(i - 1);
! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()};
! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2]));
! }
! glu.gluTessEndContour(tess);
}
}
}
--- 1240,1253 ----
if (vertices.size() > 0) {
Vertex first = (Vertex) vertices.get(0);
! Iterator iter = vertices.iterator();
! glu.gluTessBeginContour(tess);
! while (iter.hasNext()) {
! Vertex current = (Vertex) iter.next();
! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()};
! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2]));
}
+ double[] coords = new double[] {first.getX(), first.getY(), first.getZ()};
+ glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2]));
+ glu.gluTessEndContour(tess);
}
}
|