[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool Protractor.java, 1.9, 1.10
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-15 08:41:06
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23704/src/net/sourceforge/bprocessor/gl/tool Modified Files: Protractor.java Log Message: some progress on protractor Index: Protractor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Protractor.java 15 Nov 2007 07:17:32 -0000 1.9 --- Protractor.java 15 Nov 2007 08:41:09 -0000 1.10 *************** *** 36,39 **** --- 36,40 ---- private Protract protract; private Vertex normal; + private Vertex i0; private Vertex base; *************** *** 53,59 **** * @return Line */ ! protected Line createConstructor(Vertex start, Vertex end) { ! Vertex direction = end.minus(start); ! direction.normalize(); return new Line(start, direction, true, true); } --- 54,58 ---- * @return Line */ ! protected Line createConstructor(Vertex start, Vertex direction) { return new Line(start, direction, true, true); } *************** *** 69,79 **** if (start != null) { List edges = new LinkedList(); Line line; ! line = createConstructor(start.vertex(), current.vertex()); edges.add(line); feedback(edges); - Vertex i = current.vertex().minus(start.vertex()); - i.normalize(); - Vertex j = normal.cross(i); protract = new Protract(start.vertex(), i, j); glv.getView().addGlObjects3D(protract); --- 68,97 ---- if (start != null) { List edges = new LinkedList(); + + Vertex direction = current.vertex().minus(start.vertex()); + if (direction.isZero()) { + if (base != null) { + direction = base; + } else { + direction = i0; + } + } else { + direction.normalize(); + } + + Vertex i; + + if (base != null) { + i = base; + } else { + i = direction; + } + + Vertex j = normal.cross(i); + Line line; ! line = createConstructor(start.vertex(), direction); edges.add(line); feedback(edges); protract = new Protract(start.vertex(), i, j); glv.getView().addGlObjects3D(protract); *************** *** 112,116 **** @Override public void onVertex() { ! Line l = createConstructor(start.vertex(), current.vertex()); Geometry.insertConstructor(l); start = null; --- 130,136 ---- @Override public void onVertex() { ! Vertex direction = current.vertex().minus(start.vertex()); ! direction.normalize(); ! Line l = createConstructor(start.vertex(), direction); Geometry.insertConstructor(l); start = null; *************** *** 135,145 **** Plane plane = system.plane(); normal = system.getN(); lockingPlane = plane; lock = true; } else { ! onVertex(); } - updateFeedback(); - updateConstructors(); } --- 155,179 ---- Plane plane = system.plane(); normal = system.getN(); + i0 = system.getI(); lockingPlane = plane; lock = true; + updateFeedback(); + updateConstructors(); } else { ! if (base == null) { ! Vertex i = current.vertex().minus(start.vertex()); ! if (i.isZero()) { ! i = i0; ! } else { ! i.normalize(); ! } ! base = i; ! updateFeedback(); ! updateConstructors(); ! } else { ! onVertex(); ! moved(event); ! } } } *************** *** 167,175 **** */ public void cleanUp() { if (protract != null) { glv.getView().removeGlObjects3D(protract); protract = null; - base = null; } } --- 201,212 ---- */ public void cleanUp() { + super.cleanUp(); if (protract != null) { glv.getView().removeGlObjects3D(protract); protract = null; } + i0 = null; + normal = null; + base = null; } *************** *** 250,259 **** /** {@inheritDoc} */ public Plane getPlane() { ! return null; } /** {@inheritDoc} */ public Vertex intersection(Edge e) { ! return null; } } --- 287,298 ---- /** {@inheritDoc} */ public Plane getPlane() { ! Vertex n = u.cross(v); ! Plane plane = new Plane(n, origin); ! return plane; } /** {@inheritDoc} */ public Vertex intersection(Edge e) { ! return getPlane().intersection(e); } } |