Blender  V2.59
IK_solver.h
Go to the documentation of this file.
00001 /*
00002  * $Id: IK_solver.h 35154 2011-02-25 11:43:19Z jesterking $
00003  * ***** BEGIN GPL LICENSE BLOCK *****
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software Foundation,
00017  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00020  * All rights reserved.
00021  *
00022  * The Original Code is: all of this file.
00023  *
00024  * Original author: Laurence
00025  * Contributor(s): Brecht
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 
00070 #ifndef NAN_INCLUDED_IK_solver_h
00071 #define NAN_INCLUDED_IK_solver_h
00072 
00073 #ifdef __cplusplus
00074 extern "C" {
00075 #endif
00076 
00112 typedef void IK_Segment;
00113 
00114 enum IK_SegmentFlag {
00115         IK_XDOF = 1,
00116         IK_YDOF = 2,
00117         IK_ZDOF = 4,
00118         IK_TRANS_XDOF = 8,
00119         IK_TRANS_YDOF = 16,
00120         IK_TRANS_ZDOF = 32
00121 };
00122 
00123 typedef enum IK_SegmentAxis {
00124         IK_X = 0,
00125         IK_Y = 1,
00126         IK_Z = 2,
00127         IK_TRANS_X = 3,
00128         IK_TRANS_Y = 4,
00129         IK_TRANS_Z = 5
00130 } IK_SegmentAxis;
00131 
00132 extern IK_Segment *IK_CreateSegment(int flag);
00133 extern void IK_FreeSegment(IK_Segment *seg);
00134 
00135 extern void IK_SetParent(IK_Segment *seg, IK_Segment *parent);
00136 extern void IK_SetTransform(IK_Segment *seg, float start[3], float rest_basis[][3], float basis[][3], float length);
00137 extern void IK_SetLimit(IK_Segment *seg, IK_SegmentAxis axis, float lmin, float lmax);
00138 extern void IK_SetStiffness(IK_Segment *seg, IK_SegmentAxis axis, float stiffness);
00139 
00140 extern void IK_GetBasisChange(IK_Segment *seg, float basis_change[][3]);
00141 extern void IK_GetTranslationChange(IK_Segment *seg, float *translation_change);
00142 
00156 typedef void IK_Solver;
00157 
00158 IK_Solver *IK_CreateSolver(IK_Segment *root);
00159 void IK_FreeSolver(IK_Solver *solver);
00160 
00161 void IK_SolverAddGoal(IK_Solver *solver, IK_Segment *tip, float goal[3], float weight);
00162 void IK_SolverAddGoalOrientation(IK_Solver *solver, IK_Segment *tip, float goal[][3], float weight);
00163 void IK_SolverSetPoleVectorConstraint(IK_Solver *solver, IK_Segment *tip, float goal[3], float polegoal[3], float poleangle, int getangle);
00164 float IK_SolverGetPoleAngle(IK_Solver *solver);
00165 
00166 int IK_Solve(IK_Solver *solver, float tolerance, int max_iterations);
00167 
00168 
00169 #ifdef __cplusplus
00170 }
00171 #endif
00172 
00173 #endif // NAN_INCLUDED_IK_solver_h
00174