19 m_translational(translational)
49 const Matrix3d &rest_basis,
50 const Matrix3d &basis,
192 lmin = sin(lmin * 0.5);
193 lmax = sin(lmax * 0.5);
200 else if (axis == 2) {
227 double theta = dq.norm();
230 Vector3d
w = dq * (1.0 / theta);
232 double sine = sin(theta);
233 double cosine =
cos(theta);
234 double cosineInv = 1 - cosine;
236 double xsine =
w.x() * sine;
237 double ysine =
w.y() * sine;
238 double zsine =
w.z() * sine;
240 double xxcosine =
w.x() *
w.x() * cosineInv;
241 double xycosine =
w.x() *
w.y() * cosineInv;
242 double xzcosine =
w.x() *
w.z() * cosineInv;
243 double yycosine =
w.y() *
w.y() * cosineInv;
244 double yzcosine =
w.y() *
w.z() * cosineInv;
245 double zzcosine =
w.z() *
w.z() * cosineInv;
263 if (m_limit_y ==
false && m_limit_x ==
false && m_limit_z ==
false) {
279 double ax = a.x(), ay = a.y(), az = a.z();
281 clamp[0] = clamp[1] = clamp[2] =
false;
284 if (a.y() > m_max_y) {
288 else if (a.y() < m_min_y) {
294 if (m_limit_x && m_limit_z) {
296 clamp[0] = clamp[2] =
true;
299 else if (m_limit_x) {
304 else if (ax > m_max[0]) {
309 else if (m_limit_z) {
314 else if (az > m_max[1]) {
320 if (clamp[0] ==
false && clamp[1] ==
false && clamp[2] ==
false) {
399 if (m_limit ==
false) {
403 if (m_new_angle > m_max) {
404 delta[0] = m_max - m_angle;
406 else if (m_new_angle < m_min) {
407 delta[0] = m_min - m_angle;
414 m_new_angle = m_angle + delta[0];
427 m_angle = m_new_angle;
433 if (lmin > lmax || m_axis != axis) {
449 if (axis == m_axis) {
483 double theta = dq.norm();
486 Vector3d
w = dq * (1.0 / theta);
488 double sine = sin(theta);
489 double cosine =
cos(theta);
490 double cosineInv = 1 - cosine;
492 double xsine =
w.x() * sine;
493 double zsine =
w.z() * sine;
495 double xxcosine =
w.x() *
w.x() * cosineInv;
496 double xzcosine =
w.x() *
w.z() * cosineInv;
497 double zzcosine =
w.z() *
w.z() * cosineInv;
517 if (m_limit_x ==
false && m_limit_z ==
false) {
522 double ax = 0, az = 0;
524 clamp[0] = clamp[1] =
false;
526 if (m_limit_x && m_limit_z) {
531 clamp[0] = clamp[1] =
true;
534 else if (m_limit_x) {
539 else if (ax > m_max[0]) {
544 else if (m_limit_z) {
549 else if (az > m_max[1]) {
555 if (clamp[0] ==
false && clamp[1] ==
false) {
590 lmin = sin(lmin * 0.5);
591 lmax = sin(lmax * 0.5);
594 double offset = 0.5 * (lmin + lmax);
605 else if (axis == 2) {
620 else if (axis == 2) {
655 v = Vector3d(m_cos_twist, 0, m_sin_twist);
658 v = Vector3d(-m_sin_twist, 0, m_cos_twist);
674 clamp[0] = clamp[1] =
false;
680 if (m_new_angle > m_max) {
681 delta[0] = m_max - m_angle;
685 else if (m_new_angle < m_min) {
686 delta[0] = m_min - m_angle;
697 if (m_new_twist > m_max_twist) {
698 delta[1] = m_max_twist - m_twist;
699 m_new_twist = m_max_twist;
702 else if (m_new_twist < m_min_twist) {
703 delta[1] = m_min_twist - m_twist;
704 m_new_twist = m_min_twist;
710 return (clamp[0] || clamp[1]);
727 m_angle = m_new_angle;
728 m_twist = m_new_twist;
730 m_sin_twist = sin(m_twist);
731 m_cos_twist =
cos(m_twist);
752 m_limit_twist =
true;
754 else if (axis == m_axis) {
763 if (axis == m_axis) {
766 else if (axis == 1) {
775 m_axis_enabled[0] = m_axis_enabled[1] = m_axis_enabled[2] =
false;
776 m_axis_enabled[axis1] =
true;
780 m_limit[0] = m_limit[1] = m_limit[2] =
false;
785 m_axis_enabled[0] = m_axis_enabled[1] = m_axis_enabled[2] =
false;
786 m_axis_enabled[axis1] =
true;
787 m_axis_enabled[axis2] =
true;
792 m_limit[0] = m_limit[1] = m_limit[2] =
false;
797 m_axis_enabled[0] = m_axis_enabled[1] = m_axis_enabled[2] =
true;
803 m_limit[0] = m_limit[1] = m_limit[2] =
false;
813 int dof_id =
m_DoF_id, dof = 0, i, clamped =
false;
815 Vector3d dx(0.0, 0.0, 0.0);
817 for (i = 0; i < 3; i++) {
818 if (!m_axis_enabled[i]) {
829 if (m_new_translation[i] > m_max[i]) {
831 m_new_translation[i] = m_max[i];
832 clamped = clamp[dof] =
true;
834 else if (m_new_translation[i] < m_min[i]) {
836 m_new_translation[i] = m_min[i];
837 clamped = clamp[dof] =
true;
865 if (m_axis[i] == axis) {
879 m_limit[axis] =
true;
888 for (i = 0; i < 3; i++) {
893 m_new_translation *= scale;
static void RemoveTwist(Eigen::Matrix3d &R)
static bool EllipseClamp(double &ax, double &az, double *amin, double *amax)
static Eigen::Matrix3d CreateMatrix(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz)
static Eigen::Vector3d MatrixToAxisAngle(const Eigen::Matrix3d &R)
static Eigen::Matrix3d RotationMatrix(double sine, double cosine, int axis)
static Eigen::Matrix3d ComputeTwistMatrix(double tau)
static Eigen::Vector3d SphericalRangeParameters(const Eigen::Matrix3d &R)
static Eigen::Matrix3d ComputeSwingMatrix(double ax, double az)
static bool FuzzyZero(double x)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
Vector3d Axis(int dof) const
void SetLimit(int axis, double lmin, double lmax)
IK_QElbowSegment(int axis)
void Lock(int dof, IK_QJacobian &jacobian, Vector3d &delta)
void SetWeight(int axis, double weight)
bool UpdateAngle(const IK_QJacobian &jacobian, Vector3d &delta, bool *clamp)
void SetBasis(const Matrix3d &basis)
void Lock(int dof_id, double delta)
double AngleUpdate(int dof_id) const
void SetWeight(int axis, double weight)
bool UpdateAngle(const IK_QJacobian &jacobian, Vector3d &delta, bool *clamp)
Vector3d Axis(int dof) const
IK_QRevoluteSegment(int axis)
void SetBasis(const Matrix3d &basis)
void Lock(int dof, IK_QJacobian &jacobian, Vector3d &delta)
void SetLimit(int axis, double lmin, double lmax)
virtual void SetBasis(const Matrix3d &basis)
virtual EIGEN_MAKE_ALIGNED_OPERATOR_NEW ~IK_QSegment()
Vector3d m_orig_translation
void UpdateTransform(const Affine3d &global)
Affine3d m_global_transform
virtual void Scale(double scale)
void SetComposite(IK_QSegment *seg)
Matrix3d BasisChange() const
IK_QSegment(int num_DoF, bool translational)
void PrependBasis(const Matrix3d &mat)
void SetParent(IK_QSegment *parent)
IK_QSegment * m_composite
void RemoveChild(IK_QSegment *child)
Vector3d TranslationChange() const
void SetTransform(const Vector3d &start, const Matrix3d &rest_basis, const Matrix3d &basis, const double length)
void SetWeight(int axis, double weight)
Vector3d Axis(int dof) const
void Lock(int dof, IK_QJacobian &jacobian, Vector3d &delta)
bool UpdateAngle(const IK_QJacobian &jacobian, Vector3d &delta, bool *clamp)
void SetLimit(int axis, double lmin, double lmax)
void SetWeight(int axis, double weight)
void Lock(int dof, IK_QJacobian &jacobian, Vector3d &delta)
Vector3d Axis(int dof) const
bool UpdateAngle(const IK_QJacobian &jacobian, Vector3d &delta, bool *clamp)
void SetLimit(int axis, double lmin, double lmax)
void SetBasis(const Matrix3d &basis)
void SetWeight(int axis, double weight)
void Lock(int, IK_QJacobian &, Vector3d &)
Vector3d Axis(int dof) const
bool UpdateAngle(const IK_QJacobian &jacobian, Vector3d &delta, bool *clamp)
void SetLimit(int axis, double lmin, double lmax)
static double ComputeTwist(const KDL::Rotation &R)
static double EulerAngleFromMatrix(const KDL::Rotation &R, int axis)
ccl_device_inline float3 cos(float3 v)