23 #include "constraint.h"
27 using namespace qglviewer;
39 : translationConstraintType_(FREE), rotationConstraintType_(FREE)
56 const float norm = direction.
norm();
59 qWarning(
"AxisPlaneConstraint::setTranslationConstraintDir: null vector for translation constraint");
60 translationConstraintType_ = AxisPlaneConstraint::FREE;
63 translationConstraintDir_ = direction/norm;
79 float norm = direction.
norm();
82 qWarning(
"AxisPlaneConstraint::setRotationConstraintDir: null vector for rotation constraint");
83 rotationConstraintType_ = AxisPlaneConstraint::FREE;
86 rotationConstraintDir_ = direction/norm;
105 qWarning(
"AxisPlaneConstraint::setRotationConstraintType: the PLANE type cannot be used for a rotation constraints");
109 rotationConstraintType_ = type;
125 case AxisPlaneConstraint::FREE:
127 case AxisPlaneConstraint::PLANE:
131 case AxisPlaneConstraint::AXIS:
135 case AxisPlaneConstraint::FORBIDDEN:
136 translation =
Vec(0.0, 0.0, 0.0);
148 case AxisPlaneConstraint::FREE:
150 case AxisPlaneConstraint::PLANE:
152 case AxisPlaneConstraint::AXIS:
155 Vec quat =
Vec(rotation[0], rotation[1], rotation[2]);
157 rotation =
Quaternion(quat, 2.0*acos(rotation[3]));
160 case AxisPlaneConstraint::FORBIDDEN:
178 case AxisPlaneConstraint::FREE:
180 case AxisPlaneConstraint::PLANE:
189 case AxisPlaneConstraint::AXIS:
198 case AxisPlaneConstraint::FORBIDDEN:
199 translation =
Vec(0.0, 0.0, 0.0);
211 case AxisPlaneConstraint::FREE:
213 case AxisPlaneConstraint::PLANE:
215 case AxisPlaneConstraint::AXIS:
217 Vec quat(rotation[0], rotation[1], rotation[2]);
220 rotation =
Quaternion(quat, 2.0*acos(rotation[3]));
223 case AxisPlaneConstraint::FORBIDDEN:
247 case AxisPlaneConstraint::FREE:
249 case AxisPlaneConstraint::PLANE:
255 case AxisPlaneConstraint::AXIS:
261 case AxisPlaneConstraint::FORBIDDEN:
262 translation =
Vec(0.0, 0.0, 0.0);
274 case AxisPlaneConstraint::FREE:
276 case AxisPlaneConstraint::PLANE:
278 case AxisPlaneConstraint::AXIS:
281 Vec quat =
Vec(rotation[0], rotation[1], rotation[2]);
283 rotation =
Quaternion(quat, 2.0*acos(rotation[3]));
286 case AxisPlaneConstraint::FORBIDDEN: