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
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);
166 return o << v.
x <<
'\t' << v.
y <<
'\t' << v.
z;
void initFromDOMElement(const QDomElement &element)
Vec orthogonalVec() const
void projectOnPlane(const Vec &normal)
The Vec class represents 3D positions and 3D vectors.
double squaredNorm() const
void projectOnAxis(const Vec &direction)
QDomElement domElement(const QString &name, QDomDocument &document) const
static double doubleFromDom(const QDomElement &e, const QString &attribute, double defValue)
ostream & operator<<(ostream &o, const Vec &v)