25 {
26 int i,k;
27 double E[4][4] = {
28 { 1, 0, 0, 0},
29 { 0, 1, 0, 0},
30 { 0, 0, 1, 0},
31 { 0, 0, 0, 1}
32 };
33
34
35
37 for (i=0; i<4; i++) {
38 for (k=0; k<4; k++) {
39 assert ( M[i][k] == E[i][k] );
40 }
41 }
43
44
45
46 HepRotation R;
47 double angA=CLHEP::pi/3, angB=CLHEP::pi/4, angC=CLHEP::pi/6;
48
49 R.rotateX(angA); R.rotateY(angB); R.rotateZ(angC);
50 const Hep3Vector
D(1, 2, 3);
52
53 for (i=0; i<3; i++) {
54 for (k=0; k<3; k++) { assert ( M[i][k] == R[i][k] ); }
55 }
56 assert ( M(0,3) ==
D.x() );
57 assert ( M(1,3) ==
D.y() );
58 assert ( M(2,3) ==
D.z() );
59
60
61
62 const Point p0(1,1,1);
65
67 Point p2 = R*Hep3Vector(1,1,1) +
D;
68 assert( std::abs(p1.
x()-p2.
x()) <
DEL );
69 assert( std::abs(p1.
y()-p2.
y()) <
DEL );
70 assert( std::abs(p1.
z()-p2.
z()) <
DEL );
71
74 assert( std::abs(v1.
x()-n1.
x()) <
DEL );
75 assert( std::abs(v1.
y()-n1.
y()) <
DEL );
76 assert( std::abs(v1.
z()-n1.
z()) <
DEL );
77
78
79
80 p1 =
Point(M[0][0]+
D.x(), M[1][0]+
D.y(), M[2][0]+
D.z());
81 p2 =
Point(M[0][1]+
D.x(), M[1][1]+
D.y(), M[2][1]+
D.z());
82 Transformation T(
Point(0,0,0),
Point(1,0,0),
Point(0,1,0),
D, p1, p2);
83
84 for (i=0; i<4; i++) {
85 for (k=0; k<4; k++) { assert ( std::abs(M[i][k] - T[i][k]) <
DEL ); }
86 }
87
88
89
90 T.setIdentity();
91 for (i=0; i<4; i++) {
92 for (k=0; k<4; k++) { assert ( T[i][k] == E[i][k] ); }
93 }
94
95
96
97 T = M;
98 assert (T == M);
99 for (i=0; i<4; i++) {
100 for (k=0; k<4; k++) { assert ( T(i,k) == M[i][k] ); }
101 }
102
103
104
106 assert (T != M);
107 T = M * T;
108 for (i=0; i<4; i++) {
109 for (k=0; k<4; k++) { assert ( std::abs(T[i][k] - E[i][k]) <
DEL ); }
110 }
111
113 T = T * M;
114 for (i=0; i<4; i++) {
115 for (k=0; k<4; k++) { assert ( std::abs(T[i][k] - E[i][k]) <
DEL ); }
116 }
117
118
119
120 HepRotation Q;
121 Q = M.getRotation();
122 for (i=0; i<3; i++) {
123 for (k=0; k<3; k++) { assert ( R[i][k] == Q[i][k] ); }
124 }
125
126
127
128 Hep3Vector C;
129 C = M.getTranslation();
130 assert ( C.x() ==
D.x() );
131 assert ( C.y() ==
D.y() );
132 assert ( C.z() ==
D.z() );
133
134
135
136
139
144
146 T = TT*RR*SS;
147 for (i=0; i<4; i++) {
148 for (k=0; k<4; k++) {
149 assert ( std::abs(S[i][k] - SS[i][k]) <
DEL );
150 assert ( std::abs(M[i][k] - T[i][k]) <
DEL );
151 }
152 }
153
154
155
156 assert ( T.isNear(M,
DEL) );
158 T = TT*RR*S;
159 assert ( !T.isNear(M) );
160
161
162
163 Hep3Vector www(1,2,3);
167
168 vvv = www;
169 www = vvv;
170 nnn = ppp;
171
172 assert (vvv.
x() == nnn.
z());
173 assert (vvv.
y() == nnn.
y());
174 assert (vvv.
z() == nnn.
x());
175
177 www = Hep3Vector(vvv);
178
179 return 0;
180}