2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-04-16 22:40:48 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-04-16 22:40:48 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* Copyright (c) 2000 Gino van den Bergen <gino@acm.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
|
|
* provided that the above copyright notice appear in all copies and
|
|
|
|
* that both that copyright notice and this permission notice appear
|
|
|
|
* in supporting documentation. Gino van den Bergen makes no
|
|
|
|
* representations about the suitability of this software for any
|
|
|
|
* purpose. It is provided "as is" without express or implied warranty.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MT_POINT_H
|
|
|
|
#define MT_POINT_H
|
|
|
|
|
|
|
|
#include "MT_Vector3.h"
|
|
|
|
|
|
|
|
class MT_Point3 : public MT_Vector3 {
|
|
|
|
public:
|
|
|
|
MT_Point3() {}
|
|
|
|
MT_Point3(const float *v) : MT_Vector3(v) {}
|
|
|
|
MT_Point3(const double *v) : MT_Vector3(v) {}
|
2002-12-14 15:38:45 +00:00
|
|
|
MT_Point3(MT_Scalar xx, MT_Scalar yy, MT_Scalar zz) : MT_Vector3(xx, yy, zz) {}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
MT_Point3& operator+=(const MT_Vector3& v);
|
|
|
|
MT_Point3& operator-=(const MT_Vector3& v);
|
|
|
|
MT_Point3& operator=(const MT_Vector3& v);
|
Update SConscript.
Fix some warnings.
Merge with latest soc code.
What changed in IK lib:
Fully restructured, with components now as follows:
- IK_Solver: C <=> C++ interface
- IK_QSegment: base class for bone/segment with 0
to 3 DOF
- IK_QTask: base class for a task (currently there's
a position and a rotation task)
- IK_QJacobian: the Jacobian matrix, with SVD
decomposition, damping, etc
- IK_QJacobianSolver: the iterative solver
The exponential map parametrization is no longer used,
instead we have now:
- 3DOF and 2DOF XZ segments: directly update matrix
with Rodrigues' formula
- Other: Euler angles (no worries about singularities
here)
Computation of the Jacobian inverse has also changed:
- The SVD algorithm is now based on LAPACK code,
instead of NR, to avoid some problems with rounding
errors.
- When the problem is underconstrained (as is the case
most of the time), the SVD is computed for the transpose
of the Jacobian (faster).
- A new damping algorithm called the Selectively Damped
Least Squares is used, result in faster and more
stable convergence.
- Stiffness is implemented as if a weighted psuedo-inverse
was used.
Tree structure support.
Rotation limits:
- 3DOF and 2DOF XZ segments limits are based on a swing
(direct axis-angle over XZ) and twist/roll (rotation
over Y) decomposition. The swing region is an ellipse
on a sphere.
- Rotation limits are implemented using an inner clamping
loop: as long as there is a violation, a violating DOF
is clamped and removed from the Jacobian, and the solution
is recomputed.
Convergence checking is based now on the max norm of angle
change, or the maximum number of iterations.
2005-08-27 13:45:19 +00:00
|
|
|
MT_Point3& operator=(const MT_Point3& v);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
MT_Scalar distance(const MT_Point3& p) const;
|
|
|
|
MT_Scalar distance2(const MT_Point3& p) const;
|
|
|
|
|
|
|
|
MT_Point3 lerp(const MT_Point3& p, MT_Scalar t) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
MT_Point3 operator+(const MT_Point3& p, const MT_Vector3& v);
|
|
|
|
MT_Point3 operator-(const MT_Point3& p, const MT_Vector3& v);
|
|
|
|
MT_Vector3 operator-(const MT_Point3& p1, const MT_Point3& p2);
|
|
|
|
|
|
|
|
MT_Scalar MT_distance(const MT_Point3& p1, const MT_Point3& p2);
|
|
|
|
MT_Scalar MT_distance2(const MT_Point3& p1, const MT_Point3& p2);
|
|
|
|
|
|
|
|
MT_Point3 MT_lerp(const MT_Point3& p1, const MT_Point3& p2, MT_Scalar t);
|
|
|
|
|
|
|
|
#ifdef GEN_INLINED
|
|
|
|
#include "MT_Point3.inl"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
2002-10-30 02:07:20 +00:00
|
|
|
|