20 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
77 if (axis1 + axis2 == 2) {
148 IK_Segment *seg,
float start[3],
float rest[][3],
float basis[][3],
float length)
152 Vector3d mstart(start[0], start[1], start[2]);
172 double mlength(length);
175 Vector3d cstart(0, 0, 0);
177 cbasis.setIdentity();
217 if (stiffness < 0.0f) {
226 double weight = 1.0f - stiffness;
263 basis_change[0][0] = (
float)change(0, 0);
264 basis_change[1][0] = (
float)change(0, 1);
265 basis_change[2][0] = (
float)change(0, 2);
266 basis_change[0][1] = (
float)change(1, 0);
267 basis_change[1][1] = (
float)change(1, 1);
268 basis_change[2][1] = (
float)change(1, 2);
269 basis_change[0][2] = (
float)change(2, 0);
270 basis_change[1][2] = (
float)change(2, 1);
271 basis_change[2][2] = (
float)change(2, 2);
284 translation_change[0] = (
float)change[0];
285 translation_change[1] = (
float)change[1];
286 translation_change[2] = (
float)change[2];
303 if (solver ==
NULL) {
308 std::list<IK_QTask *> &tasks = qsolver->
tasks;
309 std::list<IK_QTask *>::iterator task;
311 for (task = tasks.begin(); task != tasks.end(); task++) {
320 if (solver ==
NULL || tip ==
NULL) {
332 Vector3d
pos(goal[0], goal[1], goal[2]);
336 qsolver->
tasks.push_back(ee);
341 if (solver ==
NULL || tip ==
NULL) {
366 qsolver->
tasks.push_back(orient);
376 if (solver ==
NULL || tip ==
NULL) {
388 Vector3d qgoal(goal[0], goal[1], goal[2]);
389 Vector3d qpolegoal(polegoal[0], polegoal[1], polegoal[2]);
396 if (solver ==
NULL) {
406static void IK_SolverAddCenterOfMass(
IK_Solver *solver,
418 Vector3d center(goal);
422 qsolver->
tasks.push_back(com);
428 if (solver ==
NULL) {
436 std::list<IK_QTask *> &tasks = qsolver->
tasks;
437 double tol = tolerance;
439 if (!jacobian.
Setup(root, tasks)) {
443 bool result = jacobian.
Solve(root, tasks, tol, max_iterations);
445 return ((result) ? 1 : 0);
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)
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)
IK_Segment * IK_CreateSegment(int flag)
void IK_FreeSegment(IK_Segment *seg)
static IK_QSegment * CreateSegment(int flag, bool translate)
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)
bool Translational() const
virtual void SetWeight(int, double)
void SetComposite(IK_QSegment *seg)
Matrix3d BasisChange() const
IK_QSegment * Composite() 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)
draw_view in_light_buf[] float