[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Edge.java, 1.46, 1.47 Plane.java, 1.
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-07-21 08:07:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23422/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Plane.java Log Message: Implemented locking to plane in AbstractPencil Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** Edge.java 20 Jul 2006 13:46:46 -0000 1.46 --- Edge.java 21 Jul 2006 08:07:02 -0000 1.47 *************** *** 280,287 **** public Vertex intersection(Vertex vertex) { if (intersects(vertex)) { - Project.info("A-Type"); return vertex; } else { - Project.info("B-Type"); Vertex v = to.minus(from); double length = getLength(); --- 280,285 ---- Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Plane.java 20 Jul 2006 12:56:25 -0000 1.23 --- Plane.java 21 Jul 2006 08:07:02 -0000 1.24 *************** *** 202,205 **** --- 202,219 ---- /** + * Return the projection of the vertex into this Plane + * @param vertex Vertex + * @return Projection of vertex + */ + public Vertex projection(Vertex vertex) { + Vertex vector = vertex.minus(origin()); + Vertex normal = normal(); + double t = vector.dot(normal()); + normal.scale(t / normal.length()); + vector = vector.minus(normal); + return origin().add(vector); + } + + /** * Find the intersection with the edge * @param edge The edge to intersect |