[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Vertex.java, 1.41, 1.42 CoordinateSy
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-08-11 13:36:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5788/src/net/sourceforge/bprocessor/model Modified Files: Vertex.java CoordinateSystem.java Log Message: Turning coordinatesystem using move-tool Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** Vertex.java 4 Aug 2006 11:48:04 -0000 1.41 --- Vertex.java 11 Aug 2006 13:36:20 -0000 1.42 *************** *** 130,133 **** --- 130,143 ---- return z; } + + /** + * + * @param other Vertex + */ + public void set(Vertex other) { + setX(other.getX()); + setY(other.getY()); + setZ(other.getZ()); + } /** Index: CoordinateSystem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** CoordinateSystem.java 11 Aug 2006 12:44:21 -0000 1.23 --- CoordinateSystem.java 11 Aug 2006 13:36:20 -0000 1.24 *************** *** 80,84 **** */ public void normalize() { ! j = n.cross(i); i.normalize(); j.normalize(); --- 80,103 ---- */ public void normalize() { ! normalize(i); ! } ! ! /** ! * Normalize keeping the Vertex ! * @param keep Vextor to keep ! */ ! public void normalize(Vertex keep) { ! if (keep == i) { ! n.set(i.cross(j)); ! j.set(n.cross(i)); ! } ! if (keep == j) { ! i.set(j.cross(n)); ! n.set(i.cross(j)); ! } ! if (keep == n) { ! j.set(n.cross(i)); ! i.set(j.cross(n)); ! } i.normalize(); j.normalize(); *************** *** 493,495 **** --- 512,571 ---- } } + + + /** + * @param distance Distance + * @return List of handles + */ + public List handles(double distance) { + List list = new LinkedList(); + list.add(new Tip(i, distance)); + list.add(new Tip(j, distance)); + if (!onlyPlane()) { + list.add(new Tip(n, distance)); + } + return list; + } + + /** + * Tip + */ + private class Tip extends Vertex { + /** */ + private static final long serialVersionUID = 1L; + + /** Vector this is the tip of */ + private Vertex vector; + + /** + * + * @param vector Vector + * @param distance Distance + */ + public Tip(Vertex vector, double distance) { + this.vector = vector; + Vertex v = vector.copy(); + v.scale(distance); + v = getOrigin().add(v); + setX(v.getX()); + setY(v.getY()); + setZ(v.getZ()); + } + + /** + * Update + */ + public void update() { + vector.set(this.minus(getOrigin())); + CoordinateSystem.this.normalize(vector); + } + + /** + * Parent + * @return This coordinate-system + */ + public Geometric parent() { + return CoordinateSystem.this; + } + } } |