Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.103, 1.104
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-07-12 14:35:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4908/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: changed the drawing of constructors Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** View.java 12 Jul 2006 13:24:58 -0000 1.103 --- View.java 12 Jul 2006 14:35:11 -0000 1.104 *************** *** 15,18 **** --- 15,19 ---- import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Defaults; + import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Line; import net.sourceforge.bprocessor.model.Plane; *************** *** 922,932 **** Object o = iter.next(); if (o instanceof net.sourceforge.bprocessor.model.Point) { ! drawConstructorPoint((net.sourceforge.bprocessor.model.Point)o); } else if (o instanceof Line) { ! drawConstructorLine((Line)o); } else if (o instanceof Plane) { ! drawConstructorPlane((Plane)o); } else if (o instanceof CoordinateSystem) { ! drawConstructorCS((CoordinateSystem)o); } } --- 923,945 ---- Object o = iter.next(); if (o instanceof net.sourceforge.bprocessor.model.Point) { ! drawConstructorPoint(((net.sourceforge.bprocessor.model.Point)o).getOrigin()); } else if (o instanceof Line) { ! Line l = (Line)o; ! drawConstructorPoint(l.getOrigin()); ! drawConstructorVector(l.getOrigin(), l.getDirection()); } else if (o instanceof Plane) { ! Plane p = (Plane)o; ! drawConstructorPoint(p.getOrigin()); ! drawConstructorVector(p.getOrigin(), p.getI()); ! drawConstructorVector(p.getOrigin(), p.getJ()); } else if (o instanceof CoordinateSystem) { ! CoordinateSystem cs = (CoordinateSystem)o; ! drawConstructorPoint(cs.getOrigin()); ! Vertex i = cs.getI(); ! Vertex j = cs.getJ(); ! Vertex n = cs.getN(); ! drawConstructorVector(cs.getOrigin(), i); ! drawConstructorVector(cs.getOrigin(), j); ! drawConstructorVector(cs.getOrigin(), n); } } *************** *** 939,967 **** /** ! * Draw the constructor Coordinate system ! * @param system the coordinate system ! */ ! private void drawConstructorCS(CoordinateSystem system) { ! Vertex i = system.getI(); ! Vertex j = system.getJ(); ! Vertex n = system.getN(); ! //TODO draw all three vectors ! } ! ! /** ! * Draw the plane constructor ! * @param plane the constructorplane */ ! private void drawConstructorPlane(Plane plane) { ! //TODO consider making the plane constructor as the cuttingplane } /** ! * Draw the line constructor ! * @param line the line the constructor represent */ ! private void drawConstructorLine(Line line) { ! Vertex from = line.getOrigin(); ! Vertex dir = line.getDirection(); gl.glPointSize(8); gl.glColor3fv(CONSTRUCTOR_COLOR); --- 952,972 ---- /** ! * Draw a point in the location of center ! * @param center The location for the point */ ! private void drawConstructorPoint(Vertex center) { ! gl.glPointSize(8); ! gl.glColor3fv(CONSTRUCTOR_COLOR); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(center.getX(), center.getY(), center.getZ()); ! gl.glEnd(); } /** ! * Draw a point, line and cone ! * @param from the initial vertex ! * @param dir the direction vector */ ! private void drawConstructorVector(Vertex from, Vertex dir) { gl.glPointSize(8); gl.glColor3fv(CONSTRUCTOR_COLOR); *************** *** 977,999 **** gl.glPushMatrix(); gl.glTranslated(dir.getX() + from.getX(), dir.getY() + from.getY(), dir.getZ() + from.getZ()); ! gl.glRotated(Math.toDegrees(line.degreesAboutZ()), 0, 0, 1); ! gl.glRotated(-Math.toDegrees(line.degreesAboutY()), 0, 1, 0); gl.glRotated(90, 0, 1, 0); glu.gluCylinder(quad, 0.15, 0, 0.5, 10, 10); gl.glPopMatrix(); } - - /** - * Draw a constructor point - * @param point The constructor point - */ - private void drawConstructorPoint(net.sourceforge.bprocessor.model.Point point) { - Vertex origin = point.getOrigin(); - gl.glPointSize(8); - gl.glBegin(GL.GL_POINTS); - gl.glColor4fv(CONSTRUCTOR_COLOR); - gl.glVertex3d(origin.getX(), origin.getY(), origin.getZ()); - gl.glEnd(); - } /** --- 982,991 ---- gl.glPushMatrix(); gl.glTranslated(dir.getX() + from.getX(), dir.getY() + from.getY(), dir.getZ() + from.getZ()); ! gl.glRotated(Math.toDegrees(Geometry.degreesAboutZ(dir)), 0, 0, 1); ! gl.glRotated(-Math.toDegrees(Geometry.degreesAboutY(dir)), 0, 1, 0); gl.glRotated(90, 0, 1, 0); glu.gluCylinder(quad, 0.15, 0, 0.5, 10, 10); gl.glPopMatrix(); } /** |