[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.129, 1.130
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-08-09 13:46:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19422/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Small change to drawing lines Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** View.java 8 Aug 2006 13:01:10 -0000 1.129 --- View.java 9 Aug 2006 13:46:18 -0000 1.130 *************** *** 1098,1102 **** Line l = (Line)constructor; if (l.isEditable()) { ! drawConstructorVector(l.getOrigin(), l.getDirection(), dist); } if (l.isActive() && active) { --- 1098,1102 ---- Line l = (Line)constructor; if (l.isEditable()) { ! drawVector(l.getOrigin(), l.tip(dist / 16)); } if (l.isActive() && active) { *************** *** 1196,1208 **** */ private void drawConstructorVector(Vertex from, Vertex direction, double dist) { - gl.glLineWidth(2); Vertex d = direction.copy(); d.scale(dist / 16); Vertex to = from.add(d); gl.glBegin(GL.GL_LINES); gl.glVertex3d(from.getX(), from.getY(), from.getZ()); gl.glVertex3d(to.getX(), to.getY(), to.getZ()); gl.glEnd(); ! gl.glEnable(GL.GL_LIGHTING); GLUquadric quad = glu.gluNewQuadric(); --- 1196,1237 ---- */ private void drawConstructorVector(Vertex from, Vertex direction, double dist) { Vertex d = direction.copy(); d.scale(dist / 16); Vertex to = from.add(d); + drawVectorBase(from, to); + drawVectorTip(from, to); + } + + /** + * Draw a vector + * @param from Vertex (base) + * @param to Vertex (tip) + */ + private void drawVector(Vertex from, Vertex to) { + drawVectorBase(from, to); + drawVectorTip(from, to); + } + + /** + * Draw vector base + * @param from Vertex + * @param to Vertex + */ + private void drawVectorBase(Vertex from, Vertex to) { + gl.glLineWidth(2); gl.glBegin(GL.GL_LINES); gl.glVertex3d(from.getX(), from.getY(), from.getZ()); gl.glVertex3d(to.getX(), to.getY(), to.getZ()); gl.glEnd(); ! } ! ! /** ! * Draw vector tip ! * @param from Vertex ! * @param to Vertex ! */ ! private void drawVectorTip(Vertex from, Vertex to) { ! Vertex direction = to.minus(from); ! double dist = direction.length() * 16; gl.glEnable(GL.GL_LIGHTING); GLUquadric quad = glu.gluNewQuadric(); |