38         qWarning(
"Vec::projectOnAxis: axis direction is not normalized (norm=%f).", direction.
norm());
 
   41     *
this = (((*this)*direction) / direction.
squaredNorm()) * direction;
 
   51         qWarning(
"Vec::projectOnPlane: plane normal is not normalized (norm=%f).", normal.
norm());
 
   54     *
this -= (((*this)*normal) / normal.
squaredNorm()) * normal;
 
   62     if ((fabs(y) >= 0.9*fabs(x)) && (fabs(z) >= 0.9*fabs(x)))
 
   63         return Vec(0.0, -z, y);
 
   65         if ((fabs(x) >= 0.9*fabs(y)) && (fabs(z) >= 0.9*fabs(y)))
 
   66             return Vec(-z, 0.0, x);
 
   68             return Vec(-y, x, 0.0);
 
   80     QStringList attribute;
 
   81     attribute << 
"x" << 
"y" << 
"z";
 
   82     for (
int i=0; i<attribute.size(); ++i)
 
   83 #ifdef QGLVIEWER_UNION_NOT_SUPPORTED
 
   84         this->
operator[](i) = DomUtils::doubleFromDom(element, attribute[i], 0.0);
 
   86         v_[i] = DomUtils::doubleFromDom(element, attribute[i], 0.0);
 
  126     QDomElement de = document.createElement(name);
 
  127     de.setAttribute(
"x", QString::number(x));
 
  128     de.setAttribute(
"y", QString::number(y));
 
  129     de.setAttribute(
"z", QString::number(z));
 
  156     const Vec v(element);
 
  160 ostream& operator<<(ostream& o, 
const Vec& v)
 
  162     return o << v.x << 
'\t' << v.y << 
'\t' << v.z;
 
double squaredNorm() const 
Returns the squared norm of the Vec. 
 
double norm() const 
Returns the norm of the vector. 
 
Vec orthogonalVec() const 
Returns a Vec orthogonal to the Vec. 
 
Vec()
Default constructor. 
 
void initFromDOMElement(const QDomElement &element)
Restores the Vec state from a QDomElement created by domElement(). 
 
The Vec class represents 3D positions and 3D vectors. 
 
void projectOnPlane(const Vec &normal)
Projects the Vec on the plane whose normal is normal that passes through the origin. 
 
QDomElement domElement(const QString &name, QDomDocument &document) const 
Returns an XML QDomElement that represents the Vec. 
 
void projectOnAxis(const Vec &direction)
Projects the Vec on the axis of direction direction that passes through the origin.