Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12986/src/net/sourceforge/bprocessor/model
Modified Files:
CoordinateSystem.java
Log Message:
Added constructor method that make a default coordinatesystem around a given origin (usefull for default feedback constructors) and added a method the gives the to or three edges of the coordinatesystem (i,j when only plane and i,j,n otherwise) as Guide objects just as in Line, used when drawing selection
Index: CoordinateSystem.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/CoordinateSystem.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** CoordinateSystem.java 31 Jul 2006 11:25:51 -0000 1.20
--- CoordinateSystem.java 3 Aug 2006 14:33:00 -0000 1.21
***************
*** 46,49 ****
--- 46,62 ----
/**
+ * Create a coordinatesystem with x, y and z axis, with origin as origin
+ * that is not editable but active
+ * @param origin The origin vertex
+ */
+ public CoordinateSystem(Vertex origin) {
+ super(origin, true, false);
+ i = new Vertex(1, 0, 0);
+ j = new Vertex(0, 1, 0);
+ n = new Vertex(0, 0, 1);
+ onlyPlane = false;
+ }
+
+ /**
* Constructor secure that they all are orthogonal to each other and normalized
* @param i The i vector
***************
*** 416,418 ****
--- 429,480 ----
this.n.normalize();
}
+
+ /**
+ * Return a list of edges in this coordinatesystem
+ * @return Either 2 og 3 edges whos parent() method return this
+ * @param size The length of the edges;
+ */
+ public List edges(double size) {
+ List list = new ArrayList();
+ Vertex o = getOrigin();
+ Vertex i = getI().copy();
+ i.scale(size);
+ Vertex from = o.minus(i);
+ Vertex to = o.add(i);
+ list.add(new Guide(from, to));
+ Vertex j = getJ().copy();
+ j.scale(size);
+ from = o.minus(j);
+ to = o.add(j);
+ list.add(new Guide(from, to));
+ if (!onlyPlane()) {
+ Vertex n = getN().copy();
+ n.scale(size);
+ from = o.minus(n);
+ to = o.add(n);
+ list.add(new Guide(from, to));
+ }
+ return list;
+ }
+ /**
+ * Guide
+ */
+ private class Guide extends Edge {
+ /**
+ * Constructor
+ * @param from Vertex
+ * @param to Vertex
+ */
+ public Guide(Vertex from, Vertex to) {
+ super(from, to);
+ }
+
+ /**
+ * Parent
+ * @return This line
+ */
+ public Geometric parent() {
+ return CoordinateSystem.this;
+ }
+ }
}
|