2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Original Author: Laurence
24 * Contributor(s): Brecht
26 * ***** END GPL LICENSE BLOCK *****
29 /** \file iksolver/intern/IK_QJacobianSolver.h
34 #ifndef __IK_QJACOBIANSOLVER_H__
36 #define __IK_QJACOBIANSOLVER_H__
39 * @author Laurence Bourn
46 #include "MT_Vector3.h"
47 #include "MT_Transform.h"
48 #include "IK_QJacobian.h"
49 #include "IK_QSegment.h"
52 class IK_QJacobianSolver
56 ~IK_QJacobianSolver() {}
58 // setup pole vector constraint
59 void SetPoleVectorConstraint(IK_QSegment *tip, MT_Vector3& goal,
60 MT_Vector3& polegoal, float poleangle, bool getangle);
61 float GetPoleAngle() { return m_poleangle; }
63 // call setup once before solving, if it fails don't solve
64 bool Setup(IK_QSegment *root, std::list<IK_QTask*>& tasks);
66 // returns true if converged, false if max number of iterations was used
69 std::list<IK_QTask*> tasks,
70 const MT_Scalar tolerance,
71 const int max_iterations
75 void AddSegmentList(IK_QSegment *seg);
76 bool UpdateAngles(MT_Scalar& norm);
77 void ConstrainPoleVector(IK_QSegment *root, std::list<IK_QTask*>& tasks);
79 MT_Scalar ComputeScale();
80 void Scale(MT_Scalar scale, std::list<IK_QTask*>& tasks);
84 IK_QJacobian m_jacobian;
85 IK_QJacobian m_jacobian_sub;
87 bool m_secondary_enabled;
89 std::vector<IK_QSegment*> m_segments;
91 MT_Transform m_rootmatrix;
93 bool m_poleconstraint;
96 MT_Vector3 m_polegoal;
98 IK_QSegment *m_poletip;