Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13366/src/net/sourceforge/bprocessor/model
Modified Files:
Vertex.java
Log Message:
made a project onto method the project the object calld on onto the one given as argument
Index: Vertex.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** Vertex.java 20 Jul 2006 11:08:44 -0000 1.39
--- Vertex.java 3 Aug 2006 14:33:42 -0000 1.40
***************
*** 436,438 ****
--- 436,450 ----
}
}
+
+ /**
+ * Project this vertex onto the vertex given as argument
+ * @param onto The vertex to project onto
+ * @return The projected vertex
+ */
+ public Vertex projectOnto(Vertex onto) {
+ double scale = this.dot(onto) / onto.dot(onto);
+ Vertex res = onto.copy();
+ res.scale(scale);
+ return res;
+ }
}
|