Blender V4.3
IK_QJacobianSolver.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
16#include <list>
17#include <vector>
18
19#include "IK_Math.h"
20#include "IK_QJacobian.h"
21#include "IK_QSegment.h"
22#include "IK_QTask.h"
23
25 public:
28
29 // setup pole vector constraint
31 IK_QSegment *tip, Vector3d &goal, Vector3d &polegoal, float poleangle, bool getangle);
33 {
34 return m_poleangle;
35 }
36
37 // call setup once before solving, if it fails don't solve
38 bool Setup(IK_QSegment *root, std::list<IK_QTask *> &tasks);
39
40 // returns true if converged, false if max number of iterations was used
41 bool Solve(IK_QSegment *root,
42 std::list<IK_QTask *> tasks,
43 const double tolerance,
44 const int max_iterations);
45
46 private:
47 void AddSegmentList(IK_QSegment *seg);
48 bool UpdateAngles(double &norm);
49 void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask *> &tasks);
50
51 double ComputeScale();
52 void Scale(double scale, std::list<IK_QTask *> &tasks);
53
54 private:
55 IK_QJacobian m_jacobian;
56 IK_QJacobian m_jacobian_sub;
57
58 bool m_secondary_enabled;
59
60 std::vector<IK_QSegment *> m_segments;
61
62 Affine3d m_rootmatrix;
63
64 bool m_poleconstraint;
65 bool m_getpoleangle;
66 Vector3d m_goal;
67 Vector3d m_polegoal;
68 float m_poleangle;
69 IK_QSegment *m_poletip;
70};
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
Definition btVector3.h:263
void SetPoleVectorConstraint(IK_QSegment *tip, Vector3d &goal, Vector3d &polegoal, float poleangle, bool getangle)
bool Solve(IK_QSegment *root, std::list< IK_QTask * > tasks, const double tolerance, const int max_iterations)
bool Setup(IK_QSegment *root, std::list< IK_QTask * > &tasks)