41 x1 = (fr1 - fr0).Unit();
42 y1 = (fr2 - fr0).Unit();
43 x2 = (to1 - to0).Unit();
44 y2 = (to2 - to0).Unit();
52 if (std::fabs(1.0 - cos1) <= 0.000001 || std::fabs(1.0 - cos2) <= 0.000001) {
53 std::cerr <<
"Transform3DPJ: Error : zero angle between axes" << std::endl;
56 if (std::fabs(cos1 - cos2) > 0.000001) {
57 std::cerr <<
"Transform3DPJ: Warning: angles between axes are not equal" << std::endl;
62 z1 = (
x1.Cross(
y1)).Unit();
65 z2 = (
x2.Cross(
y2)).Unit();
68 double x1x =
x1.X(), x1y =
x1.Y(), x1z =
x1.Z();
69 double y1x =
y1.X(), y1y =
y1.Y(), y1z =
y1.Z();
70 double z1x = z1.X(), z1y = z1.Y(), z1z = z1.Z();
72 double detxx = (y1y * z1z - z1y * y1z);
73 double detxy = -(y1x * z1z - z1x * y1z);
74 double detxz = (y1x * z1y - z1x * y1y);
75 double detyx = -(x1y * z1z - z1y * x1z);
76 double detyy = (x1x * z1z - z1x * x1z);
77 double detyz = -(x1x * z1y - z1x * x1y);
78 double detzx = (x1y * y1z - y1y * x1z);
79 double detzy = -(x1x * y1z - y1x * x1z);
80 double detzz = (x1x * y1y - y1x * x1y);
82 double x2x =
x2.X(), x2y =
x2.Y(), x2z =
x2.Z();
83 double y2x =
y2.X(), y2y =
y2.Y(), y2z =
y2.Z();
84 double z2x =
z2.X(), z2y =
z2.Y(), z2z =
z2.Z();
86 double txx = x2x * detxx + y2x * detyx + z2x * detzx;
87 double txy = x2x * detxy + y2x * detyy + z2x * detzy;
88 double txz = x2x * detxz + y2x * detyz + z2x * detzz;
89 double tyx = x2y * detxx + y2y * detyx + z2y * detzx;
90 double tyy = x2y * detxy + y2y * detyy + z2y * detzy;
91 double tyz = x2y * detxz + y2y * detyz + z2y * detzz;
92 double tzx = x2z * detxx + y2z * detyx + z2z * detzx;
93 double tzy = x2z * detxy + y2z * detyy + z2z * detzy;
94 double tzz = x2z * detxz + y2z * detyz + z2z * detzz;
98 double dx1 = fr0.X(), dy1 = fr0.Y(), dz1 = fr0.Z();
99 double dx2 = to0.X(), dy2 = to0.Y(), dz2 = to0.Z();
104 dx2 - txx * dx1 - txy * dy1 - txz * dz1,
108 dy2 - tyx * dx1 - tyy * dy1 - tyz * dz1,
112 dz2 - tzx * dx1 - tzy * dy1 - tzz * dz1);
129 std::cerr <<
"Transform3DPJ::inverse error: zero determinant" << std::endl;
228 r.GetComponents(rotData, rotData + 9);
230 for (
int i = 0;
i < 3; ++
i)
233 for (
int i = 0;
i < 3; ++
i)
236 for (
int i = 0;
i < 3; ++
i)
241 v.GetCoordinates(vecData, vecData + 3);
242 fM[
kDX] = vecData[0];
243 fM[
kDY] = vecData[1];
244 fM[
kDZ] = vecData[2];
250 r.GetComponents(rotData, rotData + 9);
251 for (
int i = 0;
i < 3; ++
i) {
252 for (
int j = 0;
j < 3; ++
j)
253 fM[4 *
i +
j] = rotData[3 *
i +
j];
280 double d = plane.HesseDistance();
290 t.GetComponents(
m,
m + 12);
291 os <<
"\n" <<
m[0] <<
" " <<
m[1] <<
" " <<
m[2] <<
" " <<
m[3];
292 os <<
"\n" <<
m[4] <<
" " <<
m[5] <<
" " <<
m[6] <<
" " <<
m[7];
293 os <<
"\n" <<
m[8] <<
" " <<
m[9] <<
" " <<
m[10] <<
" " <<
m[11] <<
"\n";