28 using namespace qglviewer;
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 #if QT_VERSION >= 0x040000
83 for (
int i=0; i<attribute.size(); ++i)
85 for (
unsigned int i=0; i<attribute.count(); ++i)
87 #ifdef QGLVIEWER_UNION_NOT_SUPPORTED
88 this->
operator[](i) = DomUtils::doubleFromDom(element, attribute[i], 0.0);
90 v_[i] = DomUtils::doubleFromDom(element, attribute[i], 0.0);
130 QDomElement de = document.createElement(name);
131 de.setAttribute(
"x", QString::number(x));
132 de.setAttribute(
"y", QString::number(y));
133 de.setAttribute(
"z", QString::number(z));
160 const Vec v(element);
164 ostream& operator<<(ostream& o,
const Vec& v)
166 return o << v.x <<
'\t' << v.y <<
'\t' << v.z;