Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4366/src/net/sourceforge/bprocessor/model
Modified Files:
Plane.java
Log Message:
added tests for plane and added getI and getJ for plane
Index: Plane.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** Plane.java 6 Jul 2006 10:42:08 -0000 1.21
--- Plane.java 12 Jul 2006 14:34:18 -0000 1.22
***************
*** 72,76 ****
super(origin);
Vertex normal = b.cross(a);
! normal.scale(1 / (normal.length()));
this.a = normal.getX();
this.b = normal.getY();
--- 72,76 ----
super(origin);
Vertex normal = b.cross(a);
! normal.normalize();
this.a = normal.getX();
this.b = normal.getY();
***************
*** 387,389 ****
--- 387,419 ----
return "Constructor-Plane";
}
+
+ /**
+ * Return one vector in the plane
+ * @return a vector in the plane
+ */
+ public Vertex getI() {
+ Vertex res;
+ if (a != 0.0) {
+ res = new Vertex(-d / a, 0 , 0);
+ } else if (b != 0.0) {
+ res = new Vertex(0, -d / b , 0);
+ } else {
+ res = new Vertex(0, 0 , -d / c);
+ }
+ res = res.minus(getOrigin());
+ res.normalize();
+ return res;
+ }
+
+ /**
+ * A vector perpindicular to the one returned in getI that is in the plane
+ * @return a vector in the plane perpindicular to the one returned in getI
+ */
+ public Vertex getJ() {
+ Vertex v = getI();
+ Vertex res = v.cross(normal());
+ res.normalize();
+ return res;
+
+ }
}
|