23 #include "constraint.h"
26 #include "manipulatedCameraFrame.h"
28 using namespace qglviewer;
40 : translationConstraintType_(FREE), rotationConstraintType_(FREE)
57 const float norm = direction.
norm();
60 qWarning(
"AxisPlaneConstraint::setTranslationConstraintDir: null vector for translation constraint");
61 translationConstraintType_ = AxisPlaneConstraint::FREE;
64 translationConstraintDir_ = direction/norm;
80 float norm = direction.
norm();
83 qWarning(
"AxisPlaneConstraint::setRotationConstraintDir: null vector for rotation constraint");
84 rotationConstraintType_ = AxisPlaneConstraint::FREE;
87 rotationConstraintDir_ = direction/norm;
106 qWarning(
"AxisPlaneConstraint::setRotationConstraintType: the PLANE type cannot be used for a rotation constraints");
110 rotationConstraintType_ = type;
126 case AxisPlaneConstraint::FREE:
128 case AxisPlaneConstraint::PLANE:
132 case AxisPlaneConstraint::AXIS:
136 case AxisPlaneConstraint::FORBIDDEN:
137 translation =
Vec(0.0, 0.0, 0.0);
149 case AxisPlaneConstraint::FREE:
151 case AxisPlaneConstraint::PLANE:
153 case AxisPlaneConstraint::AXIS:
156 Vec quat =
Vec(rotation[0], rotation[1], rotation[2]);
158 rotation =
Quaternion(quat, 2.0*acos(rotation[3]));
161 case AxisPlaneConstraint::FORBIDDEN:
179 case AxisPlaneConstraint::FREE:
181 case AxisPlaneConstraint::PLANE:
190 case AxisPlaneConstraint::AXIS:
199 case AxisPlaneConstraint::FORBIDDEN:
200 translation =
Vec(0.0, 0.0, 0.0);
212 case AxisPlaneConstraint::FREE:
214 case AxisPlaneConstraint::PLANE:
216 case AxisPlaneConstraint::AXIS:
218 Vec quat(rotation[0], rotation[1], rotation[2]);
221 rotation =
Quaternion(quat, 2.0*acos(rotation[3]));
224 case AxisPlaneConstraint::FORBIDDEN:
248 case AxisPlaneConstraint::FREE:
250 case AxisPlaneConstraint::PLANE:
256 case AxisPlaneConstraint::AXIS:
262 case AxisPlaneConstraint::FORBIDDEN:
263 translation =
Vec(0.0, 0.0, 0.0);
275 case AxisPlaneConstraint::FREE:
277 case AxisPlaneConstraint::PLANE:
279 case AxisPlaneConstraint::AXIS:
282 Vec quat =
Vec(rotation[0], rotation[1], rotation[2]);
284 rotation =
Quaternion(quat, 2.0*acos(rotation[3]));
287 case AxisPlaneConstraint::FORBIDDEN: