25 double tanHalfTheta = std::exp(-a);
26 double tanHalfTheta2 = tanHalfTheta * tanHalfTheta;
27 double cosTheta1 = (1 - tanHalfTheta2) / (1 + tanHalfTheta2);
28 double rh = ma * std::sqrt(1 - cosTheta1*cosTheta1);
30 set(rh*std::cos(ph), rh*std::sin(ph), ma*cosTheta1);
77 if (a == 0)
return *
this;
78 double cx = v.
x(), cy = v.
y(), cz = v.
z();
79 double ll = std::sqrt(cx*cx + cy*cy + cz*cz);
81 std::cerr <<
"BasicVector<float>::rotate() : zero axis" << std::endl;
84 double cosa = std::cos(a), sina = std::sin(a);
85 cx /= ll; cy /= ll; cz /= ll;
87 double xx = cosa + (1-cosa)*cx*cx;
88 double xy = (1-cosa)*cx*cy - sina*cz;
89 double xz = (1-cosa)*cx*cz + sina*cy;
91 double yx = (1-cosa)*cy*cx + sina*cz;
92 double yy = cosa + (1-cosa)*cy*cy;
93 double yz = (1-cosa)*cy*cz - sina*cx;
95 double zx = (1-cosa)*cz*cx - sina*cy;
96 double zy = (1-cosa)*cz*cy + sina*cx;
97 double zz = cosa + (1-cosa)*cz*cz;
99 cx = x(); cy = y(); cz = z();
100 set(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz);
181 double tanHalfTheta = std::exp(-a);
182 double tanHalfTheta2 = tanHalfTheta * tanHalfTheta;
183 double cosTheta1 = (1 - tanHalfTheta2) / (1 + tanHalfTheta2);
184 double rh = ma * std::sqrt(1 - cosTheta1*cosTheta1);
186 set(rh*std::cos(ph), rh*std::sin(ph), ma*cosTheta1);
233 if (a == 0)
return *
this;
234 double cx = v.
x(), cy = v.
y(), cz = v.
z();
235 double ll = std::sqrt(cx*cx + cy*cy + cz*cz);
237 std::cerr <<
"BasicVector<double>::rotate() : zero axis" << std::endl;
240 double cosa = std::cos(a), sina = std::sin(a);
241 cx /= ll; cy /= ll; cz /= ll;
243 double xx = cosa + (1-cosa)*cx*cx;
244 double xy = (1-cosa)*cx*cy - sina*cz;
245 double xz = (1-cosa)*cx*cz + sina*cy;
247 double yx = (1-cosa)*cy*cx + sina*cz;
248 double yy = cosa + (1-cosa)*cy*cy;
249 double yz = (1-cosa)*cy*cz - sina*cx;
251 double zx = (1-cosa)*cz*cx - sina*cy;
252 double zy = (1-cosa)*cz*cy + sina*cx;
253 double zz = cosa + (1-cosa)*cz*cz;
255 cx = x(); cy = y(); cz = z();
256 set(xx*cx+xy*cy+xz*cz, yx*cx+yy*cy+yz*cz, zx*cx+zy*cy+zz*cz);