public class Rotation extends TransformationGeometrique { public Rotation() { super(); } public Rotation(float x,float y,float z,float a) throws ArithmeticException { super(); calcul(x,y,z,a); } public Rotation(Direction d,float a) throws ArithmeticException { super(); calcul(d.c[0],d.c[1],d.c[2],a); } public void calcul(float x,float y,float z,float a) throws ArithmeticException { float d =(float) Math.sqrt(x*x+y*y+z*z); x /= d; y /= d; z /= d; float c =(float) Math.cos(a); float s =(float) Math.sin(a); m[0][0] = x*x+c*(1.0F-x*x); m[0][1] = x*y*(1.0F-c)-z*s; m[0][2] = x*z*(1.0F-c)+y*s; m[1][0] = x*y*(1.0F-c)+z*s; m[1][1] = y*y+c*(1.0F-y*y); m[1][2] = y*z*(1.0F-c)-x*s; m[2][0] = x*z*(1.0F-c)-y*s; m[2][1] = y*z*(1.0F-c)+x*s; m[2][2] = z*z+c*(1.0F-z*z); } }