[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool Protractor.java, 1.12, 1.13
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-15 12:53:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23877/src/net/sourceforge/bprocessor/gl/tool Modified Files: Protractor.java Log Message: length field Index: Protractor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Protractor.java 15 Nov 2007 12:21:43 -0000 1.12 --- Protractor.java 15 Nov 2007 12:53:56 -0000 1.13 *************** *** 39,42 **** --- 39,43 ---- private Vertex i0; private Vertex base; + private Vertex direction; /** *************** *** 70,74 **** List edges = new LinkedList(); ! Vertex direction = current.vertex().minus(start.vertex()); if (direction.isZero()) { if (base != null) { --- 71,75 ---- List edges = new LinkedList(); ! direction = current.vertex().minus(start.vertex()); if (direction.isZero()) { if (base != null) { *************** *** 118,121 **** --- 119,141 ---- * {@inheritDoc} */ + protected void updateLength() { + if (base != null) { + if (direction != null) { + double t = base.dot(direction); + double angle = Math.acos(t); + double d = normal.dot(base.cross(direction)); + if (d < 0) { + angle = 2 * Math.PI - angle; + } + double degrees = angle * 180 / Math.PI; + int i = (int) Math.round(degrees); + glv.setLengthValue(String.valueOf(i)); + } + } + } + + /** + * {@inheritDoc} + */ protected void moved(MouseEvent event) { current = findIntersection(event); |