Blender  V3.3
Macros | Typedefs | Enumerations | Functions
IK_solver.h File Reference

Go to the source code of this file.

Macros

#define IK_STRETCH_STIFF_EPS   0.01f
 
#define IK_STRETCH_STIFF_MIN   0.001f
 
#define IK_STRETCH_STIFF_MAX   1e10
 

Typedefs

typedef void IK_Segment
 
typedef enum IK_SegmentAxis IK_SegmentAxis
 
typedef void IK_Solver
 

Enumerations

enum  IK_SegmentFlag {
  IK_XDOF = 1 , IK_YDOF = 2 , IK_ZDOF = 4 , IK_SWING = 8 ,
  IK_REVOLUTE = 16 , IK_TRANSY = 32 , IK_XDOF = 1 , IK_YDOF = 2 ,
  IK_ZDOF = 4 , IK_TRANS_XDOF = 8 , IK_TRANS_YDOF = 16 , IK_TRANS_ZDOF = 32
}
 
enum  IK_SegmentAxis {
  IK_X = 0 , IK_Y = 1 , IK_Z = 2 , IK_TRANS_X = 3 ,
  IK_TRANS_Y = 4 , IK_TRANS_Z = 5 , IK_X = 0 , IK_Y = 1 ,
  IK_Z = 2 , IK_TRANS_X = 3 , IK_TRANS_Y = 4 , IK_TRANS_Z = 5
}
 

Functions

IK_SegmentIK_CreateSegment (int flag)
 
void IK_FreeSegment (IK_Segment *seg)
 
void IK_SetParent (IK_Segment *seg, IK_Segment *parent)
 
void IK_SetTransform (IK_Segment *seg, float start[3], float rest_basis[][3], float basis[][3], float length)
 
void IK_SetLimit (IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax)
 
void IK_SetStiffness (IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
 
void IK_GetBasisChange (IK_Segment *seg, float basis_change[][3])
 
void IK_GetTranslationChange (IK_Segment *seg, float *translation_change)
 
IK_SolverIK_CreateSolver (IK_Segment *root)
 
void IK_FreeSolver (IK_Solver *solver)
 
void IK_SolverAddGoal (IK_Solver *solver, IK_Segment *tip, float goal[3], float weight)
 
void IK_SolverAddGoalOrientation (IK_Solver *solver, IK_Segment *tip, float goal[][3], float weight)
 
void IK_SolverSetPoleVectorConstraint (IK_Solver *solver, IK_Segment *tip, float goal[3], float polegoal[3], float poleangle, int getangle)
 
float IK_SolverGetPoleAngle (IK_Solver *solver)
 
int IK_Solve (IK_Solver *solver, float tolerance, int max_iterations)
 

Macro Definition Documentation

◆ IK_STRETCH_STIFF_EPS

#define IK_STRETCH_STIFF_EPS   0.01f

Definition at line 144 of file IK_solver.h.

◆ IK_STRETCH_STIFF_MAX

#define IK_STRETCH_STIFF_MAX   1e10

Definition at line 146 of file IK_solver.h.

◆ IK_STRETCH_STIFF_MIN

#define IK_STRETCH_STIFF_MIN   0.001f

Definition at line 145 of file IK_solver.h.

Typedef Documentation

◆ IK_Segment

typedef void IK_Segment

Typical order of calls for solving an IK problem:

  • create number of IK_Segment's and set their parents and transforms
  • create an IK_Solver
  • set a number of goals for the IK_Solver to solve
  • call IK_Solve
  • free the IK_Solver
  • get basis and translation changes from segments
  • free all segments IK_Segment defines a single segment of an IK tree.
  • Individual segments are always defined in local coordinates.
  • The segment is assumed to be oriented in the local y-direction.
  • start is the start of the segment relative to the end of the parent segment.
  • rest_basis is a column major matrix defineding the rest position (w.r.t. which the limits are defined), must be a pure rotation
  • basis is a column major matrix defining the current change from the rest basis, must be a pure rotation
  • length is the length of the bone.
  • basis_change and translation_change respectively define the change in rotation or translation. basis_change is a column major 3x3 matrix.

The local transformation is then defined as: start * rest_basis * basis * basis_change * translation_change * translate(0,length,0)

Definition at line 79 of file IK_solver.h.

◆ IK_SegmentAxis

◆ IK_Solver

typedef void IK_Solver

An IK_Solver must be created to be able to execute the solver.

An arbitray number of goals can be created, stating that a given end effector must have a given position or rotation. If multiple goals are specified, they can be weighted (range 0..1) to get some control over their importance.

IK_Solve will execute the solver, that will run until either the system converges, or a maximum number of iterations is reached. It returns 1 if the system converged, 0 otherwise.

Definition at line 124 of file IK_solver.h.

Enumeration Type Documentation

◆ IK_SegmentAxis

Enumerator
IK_X 
IK_Y 
IK_Z 
IK_TRANS_X 
IK_TRANS_Y 
IK_TRANS_Z 
IK_X 
IK_Y 
IK_Z 
IK_TRANS_X 
IK_TRANS_Y 
IK_TRANS_Z 

Definition at line 90 of file IK_solver.h.

◆ IK_SegmentFlag

Enumerator
IK_XDOF 
IK_YDOF 
IK_ZDOF 
IK_SWING 
IK_REVOLUTE 
IK_TRANSY 
IK_XDOF 
IK_YDOF 
IK_ZDOF 
IK_TRANS_XDOF 
IK_TRANS_YDOF 
IK_TRANS_ZDOF 

Definition at line 81 of file IK_solver.h.

Function Documentation

◆ IK_CreateSegment()

IK_Segment* IK_CreateSegment ( int  flag)

Definition at line 87 of file IK_Solver.cpp.

References CreateSegment(), NULL, rot, IK_QSegment::SetComposite(), and IK_QSegment::SetParent().

Referenced by execute_posetree().

◆ IK_CreateSolver()

IK_Solver* IK_CreateSolver ( IK_Segment root)

Definition at line 259 of file IK_Solver.cpp.

References NULL, and IK_QSolver::root.

Referenced by execute_posetree().

◆ IK_FreeSegment()

void IK_FreeSegment ( IK_Segment seg)

Definition at line 112 of file IK_Solver.cpp.

References IK_QSegment::Composite().

Referenced by execute_posetree().

◆ IK_FreeSolver()

void IK_FreeSolver ( IK_Solver solver)

Definition at line 270 of file IK_Solver.cpp.

References NULL, blender::compositor::task, and IK_QSolver::tasks.

Referenced by execute_posetree().

◆ IK_GetBasisChange()

void IK_GetBasisChange ( IK_Segment seg,
float  basis_change[][3] 
)

◆ IK_GetTranslationChange()

void IK_GetTranslationChange ( IK_Segment seg,
float translation_change 
)

◆ IK_SetLimit()

void IK_SetLimit ( IK_Segment seg,
IK_SegmentAxis  axis,
float  lmin,
float  lmax 
)

◆ IK_SetParent()

void IK_SetParent ( IK_Segment seg,
IK_Segment parent 
)

Definition at line 121 of file IK_Solver.cpp.

References IK_QSegment::Composite(), and IK_QSegment::SetParent().

Referenced by execute_posetree().

◆ IK_SetStiffness()

void IK_SetStiffness ( IK_Segment seg,
IK_SegmentAxis  axis,
float  stiffness 
)

◆ IK_SetTransform()

void IK_SetTransform ( IK_Segment seg,
float  start[3],
float  rest_basis[][3],
float  basis[][3],
float  length 
)

◆ IK_Solve()

int IK_Solve ( IK_Solver solver,
float  tolerance,
int  max_iterations 
)

◆ IK_SolverAddGoal()

void IK_SolverAddGoal ( IK_Solver solver,
IK_Segment tip,
float  goal[3],
float  weight 
)

Definition at line 285 of file IK_Solver.cpp.

References IK_QSegment::Composite(), NULL, pos, IK_QTask::SetWeight(), and IK_QSolver::tasks.

Referenced by execute_posetree().

◆ IK_SolverAddGoalOrientation()

void IK_SolverAddGoalOrientation ( IK_Solver solver,
IK_Segment tip,
float  goal[][3],
float  weight 
)

◆ IK_SolverGetPoleAngle()

float IK_SolverGetPoleAngle ( IK_Solver solver)

Definition at line 355 of file IK_Solver.cpp.

References IK_QJacobianSolver::GetPoleAngle(), NULL, and IK_QSolver::solver.

Referenced by execute_posetree().

◆ IK_SolverSetPoleVectorConstraint()

void IK_SolverSetPoleVectorConstraint ( IK_Solver solver,
IK_Segment tip,
float  goal[3],
float  polegoal[3],
float  poleangle,
int  getangle 
)