/* Auteur: Nicolas JANEY */ /* nicolas.janey@univ-fcomte.fr */ /* Octobre 2008 */ /* Un programme de test de l'utilisation */ /* des coordonnees homogenes et des transformations */ /* geometriques en coordonnees homogenes */ public class MathematiquesMatricielles { public static void main(String [] args) { Position3D p1 = new Position3D(-1.1, 0.1, 1.0); Position3D p2 = new Position3D( 0.3,-1.6, 3.0); Position3D p3 = new Position3D( 1.2,-0.2,-1.0); Position3D p4 = new Position3D(-2.2, 0.9, 2.2); Direction3D d1 = new Direction3D(-1.1, 0.1, 1.0); Direction3D d2 = new Direction3D( 0.3,-1.6, 3.0); Direction3D d3 = new Direction3D( 1.2,-0.2,-1.0); Direction3D d4 = new Direction3D(-2.2, 0.9, 2.2); Rotation3D r = new Rotation3D(25.0,1.0,0.5,1.0); Translation3D t = new Translation3D(1.5,2.0,0.6); Scale3D s = new Scale3D(3.0,1.5,0.5); Position3D np1 = t.transform(p1); Position3D np2 = r.transform(p2); Position3D np3 = s.transform(p3); Direction3D nd1 = t.transform(d1); Direction3D nd2 = r.transform(d2); Direction3D nd3 = s.transform(d3); System.out.println("Translation"); System.out.println(p1); System.out.println(np1); System.out.println(d1); System.out.println(nd1); System.out.println(); System.out.println("Rotation"); System.out.println(p2); System.out.println(np2); System.out.println(d2); System.out.println(nd2); System.out.println(); System.out.println("Scale"); System.out.println(p3); System.out.println(np3); System.out.println(d3); System.out.println(nd3); TransformationGeometrique3D tg; tg = TransformationGeometrique3D.compose(r,t); tg = TransformationGeometrique3D.compose(s,tg); Position3D np4 = tg.transform(p4); Position3D nnp4 = t.transform(p4); nnp4 = r.transform(nnp4); nnp4 = s.transform(nnp4); Direction3D nd4 = tg.transform(d4); Direction3D nnd4 = t.transform(d4); nnd4 = r.transform(nnd4); nnd4 = s.transform(nnd4); System.out.println(); System.out.println("Composition"); System.out.println(); System.out.println(tg); System.out.println(); System.out.println(p4); System.out.println(np4); System.out.println(nnp4); System.out.println(d4); System.out.println(nd4); System.out.println(nnd4); System.out.println(); } }