18 #include "Math/GenVector/Plane3D.h"
46 x1 = (fr1 - fr0).Unit();
47 y1 = (fr2 - fr0).Unit();
48 x2 = (to1 - to0).Unit();
49 y2 = (to2 - to0).Unit();
57 if (std::fabs(1.0-cos1) <= 0.000001 || std::fabs(1.0-cos2) <= 0.000001) {
58 std::cerr <<
"Transform3DPJ: Error : zero angle between axes" << std::endl;
61 if (std::fabs(cos1-cos2) > 0.000001) {
62 std::cerr <<
"Transform3DPJ: Warning: angles between axes are not equal"
68 z1 = (x1.Cross(y1)).Unit();
71 z2 = (x2.Cross(y2)).Unit();
74 double x1x = x1.X(), x1y = x1.Y(), x1z = x1.Z();
75 double y1x = y1.X(), y1y = y1.Y(), y1z = y1.Z();
76 double z1x = z1.X(), z1y = z1.Y(), z1z = z1.Z();
78 double detxx = (y1y*z1z - z1y*y1z);
79 double detxy = -(y1x*z1z - z1x*y1z);
80 double detxz = (y1x*z1y - z1x*y1y);
81 double detyx = -(x1y*z1z - z1y*x1z);
82 double detyy = (x1x*z1z - z1x*x1z);
83 double detyz = -(x1x*z1y - z1x*x1y);
84 double detzx = (x1y*y1z - y1y*x1z);
85 double detzy = -(x1x*y1z - y1x*x1z);
86 double detzz = (x1x*y1y - y1x*x1y);
88 double x2x = x2.X(), x2y = x2.Y(), x2z = x2.Z();
89 double y2x = y2.X(), y2y = y2.Y(), y2z = y2.Z();
90 double z2x = z2.X(), z2y = z2.Y(), z2z = z2.Z();
92 double txx = x2x*detxx + y2x*detyx + z2x*detzx;
93 double txy = x2x*detxy + y2x*detyy + z2x*detzy;
94 double txz = x2x*detxz + y2x*detyz + z2x*detzz;
95 double tyx = x2y*detxx + y2y*detyx + z2y*detzx;
96 double tyy = x2y*detxy + y2y*detyy + z2y*detzy;
97 double tyz = x2y*detxz + y2y*detyz + z2y*detzz;
98 double tzx = x2z*detxx + y2z*detyx + z2z*detzx;
99 double tzy = x2z*detxy + y2z*detyy + z2z*detzy;
100 double tzz = x2z*detxz + y2z*detyz + z2z*detzz;
104 double dx1 = fr0.X(), dy1 = fr0.Y(), dz1 = fr0.Z();
105 double dx2 = to0.X(), dy2 = to0.Y(), dz2 = to0.Z();
108 tyx, tyy, tyz, dy2-tyx*dx1-tyy*dy1-tyz*dz1,
109 tzx, tzy, tzz, dz2-tzx*dx1-tzy*dy1-tzz*dz1);
126 double det = fM[
kXX]*detxx - fM[
kXY]*detxy + fM[
kXZ]*detxz;
128 std::cerr <<
"Transform3DPJ::inverse error: zero determinant" << std::endl;
131 det = 1./det; detxx *= det; detxy *= det; detxz *= det;
132 double detyx = (fM[
kXY]*fM[
kZZ] - fM[
kXZ]*fM[
kZY] )*det;
133 double detyy = (fM[
kXX]*fM[
kZZ] - fM[
kXZ]*fM[
kZX] )*det;
134 double detyz = (fM[
kXX]*fM[
kZY] - fM[
kXY]*fM[
kZX] )*det;
135 double detzx = (fM[
kXY]*fM[
kYZ] - fM[
kXZ]*fM[
kYY] )*det;
136 double detzy = (fM[
kXX]*fM[
kYZ] - fM[
kXZ]*fM[
kYX] )*det;
137 double detzz = (fM[
kXX]*fM[
kYY] - fM[
kXY]*fM[
kYX] )*det;
139 (detxx, -detyx, detzx, -detxx*fM[
kDX]+detyx*fM[
kDY]-detzx*fM[
kDZ],
140 -detxy, detyy, -detzy, detxy*fM[
kDX]-detyy*fM[
kDY]+detzy*fM[kDZ],
141 detxz, -detyz, detzz, -detxz*fM[
kDX]+detyz*fM[
kDY]-detzz*fM[kDZ]);
217 r.GetComponents(rotData, rotData +9);
219 for (
int i = 0;
i < 3; ++
i)
222 for (
int i = 0;
i < 3; ++
i)
225 for (
int i = 0;
i < 3; ++
i)
230 v.GetCoordinates(vecData, vecData+3);
231 fM[
kDX] = vecData[0];
232 fM[
kDY] = vecData[1];
233 fM[
kDZ] = vecData[2];
241 r.GetComponents(rotData, rotData +9);
242 for (
int i = 0;
i < 3; ++
i) {
243 for (
int j = 0;
j < 3; ++
j)
244 fM[4*
i +
j] = rotData[3*
i+
j];
264 double d = plane.HesseDistance();
265 XYZPoint p( - d * n.X() , - d *n.Y(), -d *n.Z() );
266 return Plane3D (
operator() (n),
operator() (
p) );
276 os <<
"\n" << m[0] <<
" " << m[1] <<
" " << m[2] <<
" " << m[3] ;
277 os <<
"\n" << m[4] <<
" " << m[5] <<
" " << m[6] <<
" " << m[7] ;
278 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