24 #include "../extern/IK_solver.h"
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49 ndof += (flag &
IK_XDOF) ? 1 : 0;
50 ndof += (flag &
IK_YDOF) ? 1 : 0;
51 ndof += (flag &
IK_ZDOF) ? 1 : 0;
77 axis2 = (flag &
IK_YDOF) ? 1 : 2;
87 if (axis1 + axis2 == 2)
149 IK_Segment *seg,
float start[3],
float rest[][3],
float basis[][3],
float length)
153 Vector3d mstart(start[0], start[1], start[2]);
176 Vector3d cstart(0, 0, 0);
178 cbasis.setIdentity();
212 if (stiffness < 0.0f)
219 double weight = 1.0f - stiffness;
250 basis_change[0][0] = (
float)change(0, 0);
251 basis_change[1][0] = (
float)change(0, 1);
252 basis_change[2][0] = (
float)change(0, 2);
253 basis_change[0][1] = (
float)change(1, 0);
254 basis_change[1][1] = (
float)change(1, 1);
255 basis_change[2][1] = (
float)change(1, 2);
256 basis_change[0][2] = (
float)change(2, 0);
257 basis_change[1][2] = (
float)change(2, 1);
258 basis_change[2][2] = (
float)change(2, 2);
270 translation_change[0] = (
float)change[0];
271 translation_change[1] = (
float)change[1];
272 translation_change[2] = (
float)change[2];
292 std::list<IK_QTask *> &tasks = qsolver->
tasks;
293 std::list<IK_QTask *>::iterator
task;
313 Vector3d
pos(goal[0], goal[1], goal[2]);
317 qsolver->
tasks.push_back(ee);
345 qsolver->
tasks.push_back(orient);
365 Vector3d qgoal(goal[0], goal[1], goal[2]);
366 Vector3d qpolegoal(polegoal[0], polegoal[1], polegoal[2]);
382 static void IK_SolverAddCenterOfMass(
IK_Solver *solver,
398 qsolver->
tasks.push_back(com);
411 std::list<IK_QTask *> &tasks = qsolver->
tasks;
412 double tol = tolerance;
414 if (!jacobian.
Setup(root, tasks))
417 bool result = jacobian.
Solve(root, tasks, tol, max_iterations);
419 return ((
result) ? 1 : 0);
typedef float(TangentPoint)[2]
NSNotificationCenter * center
static Eigen::Matrix3d CreateMatrix(double xx, double xy, double xz, double yx, double yy, double yz, double zx, double zy, double zz)
IK_Solver * IK_CreateSolver(IK_Segment *root)
float IK_SolverGetPoleAngle(IK_Solver *solver)
IK_Segment * IK_CreateSegment(int flag)
static IK_QSegment * CreateSegment(int flag, bool translate)
void IK_SolverSetPoleVectorConstraint(IK_Solver *solver, IK_Segment *tip, float goal[3], float polegoal[3], float poleangle, int getangle)
void IK_SetParent(IK_Segment *seg, IK_Segment *parent)
void IK_FreeSolver(IK_Solver *solver)
void IK_FreeSegment(IK_Segment *seg)
void IK_SolverAddGoalOrientation(IK_Solver *solver, IK_Segment *tip, float goal[][3], float weight)
void IK_SetLimit(IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax)
void IK_SolverAddGoal(IK_Solver *solver, IK_Segment *tip, float goal[3], float weight)
int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations)
void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3])
void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
void IK_GetTranslationChange(IK_Segment *seg, float *translation_change)
void IK_SetTransform(IK_Segment *seg, float start[3], float rest[][3], float basis[][3], float length)
#define IK_STRETCH_STIFF_EPS
SIMD_FORCE_INLINE btScalar length(const btQuaternion &q)
Return the length of a quaternion.
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)
IK_QSegment * Composite() const
bool Translational() const
virtual void SetWeight(int, double)
void SetComposite(IK_QSegment *seg)
Matrix3d BasisChange() const
void SetParent(IK_QSegment *parent)
virtual void SetLimit(int, double, double)
Vector3d TranslationChange() const
void SetTransform(const Vector3d &start, const Matrix3d &rest_basis, const Matrix3d &basis, const double length)
IK_QJacobianSolver solver
std::list< IK_QTask * > tasks
EIGEN_MAKE_ALIGNED_OPERATOR_NEW IK_QSolver()
void SetWeight(double weight)
struct blender::compositor::@172::@174 task