[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Geometry.java,1.10,1.11
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2006-01-30 14:12:10
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10677/src/net/sourceforge/bprocessor/model Modified Files: Geometry.java Log Message: Now the rotation tool does work but still in a simple matter and with no snap or info of angle rotated. Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Geometry.java 24 Jan 2006 14:10:42 -0000 1.10 --- Geometry.java 30 Jan 2006 14:11:51 -0000 1.11 *************** *** 93,96 **** --- 93,121 ---- } + /** + * Rotate + * @param angle The angle + * @param x The x + * @param y The y + * @param z The z + * @param vector The vector to rotate + * @param center The center of rotation + */ + public static void rotate(double angle, double x, double y, double z, + Vertex vector, Vertex center) { + + double[] v = new double[4]; + + v[0] = vector.getX() - center.getX(); + v[1] = vector.getY() - center.getY(); + v[2] = vector.getZ() - center.getZ(); + v[3] = 1; + Matrix rotation = Matrix.rotation(angle, x, y, z); + v = rotation.multiply(v); + vector.setX(v[0] + center.getX()); + vector.setY(v[1] + center.getY()); + vector.setZ(v[2] + center.getZ()); + } + /** |