Blender  V3.3
IK_solver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
38 #ifndef __IK_SOLVER_H__
39 #define __IK_SOLVER_H__
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
79 typedef void IK_Segment;
80 
82  IK_XDOF = 1,
83  IK_YDOF = 2,
84  IK_ZDOF = 4,
87  IK_TRANS_ZDOF = 32
88 };
89 
90 typedef enum IK_SegmentAxis {
91  IK_X = 0,
92  IK_Y = 1,
93  IK_Z = 2,
96  IK_TRANS_Z = 5
98 
99 extern IK_Segment *IK_CreateSegment(int flag);
100 extern void IK_FreeSegment(IK_Segment *seg);
101 
102 extern void IK_SetParent(IK_Segment *seg, IK_Segment *parent);
103 extern void IK_SetTransform(
104  IK_Segment *seg, float start[3], float rest_basis[][3], float basis[][3], float length);
105 extern void IK_SetLimit(IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax);
106 extern void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness);
107 
108 extern void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3]);
109 extern void IK_GetTranslationChange(IK_Segment *seg, float *translation_change);
110 
124 typedef void IK_Solver;
125 
127 void IK_FreeSolver(IK_Solver *solver);
128 
129 void IK_SolverAddGoal(IK_Solver *solver, IK_Segment *tip, float goal[3], float weight);
131  IK_Segment *tip,
132  float goal[][3],
133  float weight);
135  IK_Segment *tip,
136  float goal[3],
137  float polegoal[3],
138  float poleangle,
139  int getangle);
140 float IK_SolverGetPoleAngle(IK_Solver *solver);
141 
142 int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations);
143 
144 #define IK_STRETCH_STIFF_EPS 0.01f
145 #define IK_STRETCH_STIFF_MIN 0.001f
146 #define IK_STRETCH_STIFF_MAX 1e10
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif // __IK_SOLVER_H__
IK_Solver * IK_CreateSolver(IK_Segment *root)
Definition: IK_Solver.cpp:259
float IK_SolverGetPoleAngle(IK_Solver *solver)
Definition: IK_Solver.cpp:355
IK_Segment * IK_CreateSegment(int flag)
Definition: IK_Solver.cpp:87
void IK_SolverSetPoleVectorConstraint(IK_Solver *solver, IK_Segment *tip, float goal[3], float polegoal[3], float poleangle, int getangle)
Definition: IK_Solver.cpp:332
void IK_Segment
Definition: IK_solver.h:79
void IK_SetParent(IK_Segment *seg, IK_Segment *parent)
Definition: IK_Solver.cpp:121
void IK_FreeSolver(IK_Solver *solver)
Definition: IK_Solver.cpp:270
void IK_FreeSegment(IK_Segment *seg)
Definition: IK_Solver.cpp:112
@ IK_ZDOF
Definition: IK_solver.h:84
@ IK_TRANS_XDOF
Definition: IK_solver.h:85
@ IK_TRANS_ZDOF
Definition: IK_solver.h:87
@ IK_XDOF
Definition: IK_solver.h:82
@ IK_YDOF
Definition: IK_solver.h:83
@ IK_TRANS_YDOF
Definition: IK_solver.h:86
void IK_SolverAddGoalOrientation(IK_Solver *solver, IK_Segment *tip, float goal[][3], float weight)
Definition: IK_Solver.cpp:304
void IK_SetLimit(IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax)
Definition: IK_Solver.cpp:171
void IK_SolverAddGoal(IK_Solver *solver, IK_Segment *tip, float goal[3], float weight)
Definition: IK_Solver.cpp:285
int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations)
Definition: IK_Solver.cpp:386
void IK_SetTransform(IK_Segment *seg, float start[3], float rest_basis[][3], float basis[][3], float length)
Definition: IK_Solver.cpp:132
void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3])
Definition: IK_Solver.cpp:224
IK_SegmentAxis
Definition: IK_solver.h:90
@ IK_X
Definition: IK_solver.h:91
@ IK_TRANS_X
Definition: IK_solver.h:94
@ IK_Y
Definition: IK_solver.h:92
@ IK_TRANS_Y
Definition: IK_solver.h:95
@ IK_TRANS_Z
Definition: IK_solver.h:96
@ IK_Z
Definition: IK_solver.h:93
void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness)
Definition: IK_Solver.cpp:194
void IK_GetTranslationChange(IK_Segment *seg, float *translation_change)
Definition: IK_Solver.cpp:245
void IK_Solver
Definition: IK_solver.h:124
IK_SegmentFlag
IK_SegmentAxis
T length(const vec_base< T, Size > &a)