Merge pull request #772 from maxGimeno/Polyhedron_demo-Fix_for_770

Polyhedron_demo : Fix for #770
This commit is contained in:
Sebastien Loriot 2016-02-16 16:30:48 +01:00
commit b1b5bcd4f1
1 changed files with 6 additions and 2 deletions

View File

@ -133,11 +133,15 @@ public Q_SLOTS:
}
void setNormal(float x, float y, float z) {
frame->setOrientation(x, y, z, 0.f);
QVector3D normal(x,y,z);
QVector3D origin(0,0,1);
QQuaternion q(CGAL::sqrt((normal.lengthSquared()) * (origin.lengthSquared())) + QVector3D::dotProduct(origin, normal),QVector3D::crossProduct(origin, normal));
q.normalize();
frame->setOrientation(q.x(), q.y(), q.z(), q.scalar());
}
void setNormal(double x, double y, double z) {
frame->setOrientation((float)x, (float)y, (float)z, 0.f);
setNormal((float)x, (float)y, (float)z);
}
void setClonable(bool b = true) {