[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Vertex.java,1.5,1.6
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-08-30 13:15:04
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7616 Modified Files: Vertex.java Log Message: method for calculating derterminants Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Vertex.java 16 Aug 2005 11:45:03 -0000 1.5 --- Vertex.java 30 Aug 2005 13:14:55 -0000 1.6 *************** *** 225,228 **** --- 225,254 ---- return Math.sqrt(Math.abs(getX() * getX() + getY() * getY() + getZ() * getZ())); } + + /** + * Computes the the determinant of this and to other vertecies. + * The form is: determinant{this, v, u}. + * @param v the second vertex + * @param u the third vertex + * @return the determinant. + */ + public double determinant(Vertex v, Vertex u) { + double tx = this.getX(); + double ty = this.getY(); + double tz = this.getZ(); + + double vx = v.getX(); + double vy = v.getY(); + double vz = v.getZ(); + + double ux = u.getX(); + double uy = u.getY(); + double uz = u.getZ(); + + double result = tx * ((vy * uz) - (vz * uy)); + result -= vx * ((ty * uz) - (tz * uy)); + result += ux * ((ty * vz) - (tz * vy)); + return result; + } /** |