8 #include "../extern/IK_solver.h"
19 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
33 ndof += (flag &
IK_XDOF) ? 1 : 0;
34 ndof += (flag &
IK_YDOF) ? 1 : 0;
35 ndof += (flag &
IK_ZDOF) ? 1 : 0;
61 axis2 = (flag &
IK_YDOF) ? 1 : 2;
71 if (axis1 + axis2 == 2)
133 IK_Segment *seg,
float start[3],
float rest[][3],
float basis[][3],
float length)
137 Vector3d mstart(start[0], start[1], start[2]);
160 Vector3d cstart(0, 0, 0);
162 cbasis.setIdentity();
196 if (stiffness < 0.0f)
203 double weight = 1.0f - stiffness;
234 basis_change[0][0] = (
float)change(0, 0);
235 basis_change[1][0] = (
float)change(0, 1);
236 basis_change[2][0] = (
float)change(0, 2);
237 basis_change[0][1] = (
float)change(1, 0);
238 basis_change[1][1] = (
float)change(1, 1);
239 basis_change[2][1] = (
float)change(1, 2);
240 basis_change[0][2] = (
float)change(2, 0);
241 basis_change[1][2] = (
float)change(2, 1);
242 basis_change[2][2] = (
float)change(2, 2);
254 translation_change[0] = (
float)change[0];
255 translation_change[1] = (
float)change[1];
256 translation_change[2] = (
float)change[2];
276 std::list<IK_QTask *> &tasks = qsolver->
tasks;
277 std::list<IK_QTask *>::iterator
task;
297 Vector3d
pos(goal[0], goal[1], goal[2]);
301 qsolver->
tasks.push_back(ee);
329 qsolver->
tasks.push_back(orient);
349 Vector3d qgoal(goal[0], goal[1], goal[2]);
350 Vector3d qpolegoal(polegoal[0], polegoal[1], polegoal[2]);
366 static void IK_SolverAddCenterOfMass(
IK_Solver *solver,
382 qsolver->
tasks.push_back(com);
395 std::list<IK_QTask *> &tasks = qsolver->
tasks;
396 double tol = tolerance;
398 if (!jacobian.
Setup(root, tasks))
401 bool result = jacobian.
Solve(root, tasks, tol, max_iterations);
403 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
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::@179::@181 task
T length(const vec_base< T, Size > &a)