diff --git a/Polyhedron/demo/Polyhedron/Scene_plane_item.h b/Polyhedron/demo/Polyhedron/Scene_plane_item.h index d7e07bfb1fb..ab08af0c789 100644 --- a/Polyhedron/demo/Polyhedron/Scene_plane_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_plane_item.h @@ -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) {