vec-misc.hpp File Reference

Go to the source code of this file.


quat vr2q (const vec &v, const double &_r)
quat vt2q (const vec &v, const double &theta)
void swap (vec &v1, vec &v2)

Function Documentation

quat vr2q const vec v,
const double &  _r

return quat from vec and real

Definition at line 3 of file vec-misc.hpp.

Referenced by orbit(), and rotate().

00004 {
00005   return quat(v.x, v.y, v.z, _r);
00006 }

quat vt2q const vec v,
const double &  theta

return quat from vec and angle

Definition at line 10 of file vec-misc.hpp.

References normal(), vec::x, vec::y, and vec::z.

00011 {
00012   vec n(normal(v));
00013   double sin_theta_half(std::sin(0.5*theta));
00014   return quat( n.x*sin_theta_half, n.y*sin_theta_half, n.z*sin_theta_half,
00015                std::cos(0.5*theta) );
00016 }

void swap vec v1,
vec v2

swap two vecs

Definition at line 24 of file vec-misc.hpp.

00025 {
00026   vec _v1(v1);
00027   v1 = v2;
00028   v2 =_v1;
00029 }

Generated on Tue Mar 15 16:02:38 2005 for QVM by  doxygen 1.4.1