40 const XYZPoint & to0,
const XYZPoint & to1,
const XYZPoint & to2 )
44 XYZVector
x1,y1,z1,
x2,y2,z2;
45 x1 = (fr1 - fr0).Unit();
46 y1 = (fr2 - fr0).Unit();
47 x2 = (to1 - to0).Unit();
48 y2 = (to2 - to0).Unit();
56 if (std::fabs(1.0-cos1) <= 0.000001 || std::fabs(1.0-cos2) <= 0.000001) {
57 std::cerr <<
"Transform3DPJ: Error : zero angle between axes" << std::endl;
60 if (std::fabs(cos1-cos2) > 0.000001) {
61 std::cerr <<
"Transform3DPJ: Warning: angles between axes are not equal" 67 z1 = (x1.Cross(y1)).Unit();
70 z2 = (x2.Cross(y2)).Unit();
73 double x1x = x1.X(), x1y = x1.Y(), x1z = x1.Z();
74 double y1x = y1.X(), y1y = y1.Y(), y1z = y1.Z();
75 double z1x = z1.X(), z1y = z1.Y(), z1z = z1.Z();
77 double detxx = (y1y*z1z - z1y*y1z);
78 double detxy = -(y1x*z1z - z1x*y1z);
79 double detxz = (y1x*z1y - z1x*y1y);
80 double detyx = -(x1y*z1z - z1y*x1z);
81 double detyy = (x1x*z1z - z1x*x1z);
82 double detyz = -(x1x*z1y - z1x*x1y);
83 double detzx = (x1y*y1z - y1y*x1z);
84 double detzy = -(x1x*y1z - y1x*x1z);
85 double detzz = (x1x*y1y - y1x*x1y);
87 double x2x = x2.X(), x2y = x2.Y(), x2z = x2.Z();
88 double y2x = y2.X(), y2y = y2.Y(), y2z = y2.Z();
89 double z2x = z2.X(), z2y = z2.Y(), z2z = z2.Z();
91 double txx = x2x*detxx + y2x*detyx + z2x*detzx;
92 double txy = x2x*detxy + y2x*detyy + z2x*detzy;
93 double txz = x2x*detxz + y2x*detyz + z2x*detzz;
94 double tyx = x2y*detxx + y2y*detyx + z2y*detzx;
95 double tyy = x2y*detxy + y2y*detyy + z2y*detzy;
96 double tyz = x2y*detxz + y2y*detyz + z2y*detzz;
97 double tzx = x2z*detxx + y2z*detyx + z2z*detzx;
98 double tzy = x2z*detxy + y2z*detyy + z2z*detzy;
99 double tzz = x2z*detxz + y2z*detyz + z2z*detzz;
103 double dx1 = fr0.X(), dy1 = fr0.Y(), dz1 = fr0.Z();
104 double dx2 = to0.X(), dy2 = to0.Y(), dz2 = to0.Z();
107 tyx, tyy, tyz, dy2-tyx*dx1-tyy*dy1-tyz*dz1,
108 tzx, tzy, tzz, dz2-tzx*dx1-tzy*dy1-tzz*dz1);
125 double det = fM[
kXX]*detxx - fM[
kXY]*detxy + fM[
kXZ]*detxz;
127 std::cerr <<
"Transform3DPJ::inverse error: zero determinant" << std::endl;
130 det = 1./det; detxx *= det; detxy *= det; detxz *= det;
131 double detyx = (fM[
kXY]*fM[
kZZ] - fM[
kXZ]*fM[
kZY] )*det;
132 double detyy = (fM[
kXX]*fM[
kZZ] - fM[
kXZ]*fM[
kZX] )*det;
133 double detyz = (fM[
kXX]*fM[
kZY] - fM[
kXY]*fM[
kZX] )*det;
134 double detzx = (fM[
kXY]*fM[
kYZ] - fM[
kXZ]*fM[
kYY] )*det;
135 double detzy = (fM[
kXX]*fM[
kYZ] - fM[
kXZ]*fM[
kYX] )*det;
136 double detzz = (fM[
kXX]*fM[
kYY] - fM[
kXY]*fM[
kYX] )*det;
138 (detxx, -detyx, detzx, -detxx*fM[
kDX]+detyx*fM[
kDY]-detzx*fM[
kDZ],
139 -detxy, detyy, -detzy, detxy*fM[
kDX]-detyy*fM[
kDY]+detzy*fM[kDZ],
140 detxz, -detyz, detzz, -detxz*fM[
kDX]+detyz*fM[
kDY]-detzz*fM[kDZ]);
163 XYZPoint pnew =
r(p);
216 r.GetComponents(rotData, rotData +9);
218 for (
int i = 0;
i < 3; ++
i)
221 for (
int i = 0;
i < 3; ++
i)
224 for (
int i = 0;
i < 3; ++
i)
229 v.GetCoordinates(vecData, vecData+3);
230 fM[
kDX] = vecData[0];
231 fM[
kDY] = vecData[1];
232 fM[
kDZ] = vecData[2];
240 r.GetComponents(rotData, rotData +9);
241 for (
int i = 0;
i < 3; ++
i) {
242 for (
int j = 0; j < 3; ++j)
243 fM[4*
i + j] = rotData[3*
i+j];
260 XYZVector
n = plane.Normal();
263 double d = plane.HesseDistance();
264 XYZPoint
p( - d * n.X() , - d *n.Y(), -d *n.Z() );
265 return Plane3D (
operator() (n),
operator() (p) );
275 os <<
"\n" << m[0] <<
" " << m[1] <<
" " << m[2] <<
" " << m[3] ;
276 os <<
"\n" << m[4] <<
" " << m[5] <<
" " << m[6] <<
" " << m[7] ;
277 os <<
"\n" << m[8] <<
" " << m[9] <<
" " << m[10]<<
" " << m[11] <<
"\n";
std::ostream & operator<<(std::ostream &os, const Transform3DPJ &t)
Transform3DPJ::Vector XYZVector
Transform3DPJ::Point XYZPoint
ROOT::Math::Plane3D Plane3D