2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_CCD_IK_SOLVER_H
|
|
|
|
#define DUST3D_CCD_IK_SOLVER_H
|
2018-05-24 01:44:40 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <QVector3D>
|
|
|
|
#include <QQuaternion>
|
|
|
|
|
|
|
|
struct CCDIKNode
|
|
|
|
{
|
|
|
|
QVector3D position;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CCDIKSolver
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CCDIKSolver();
|
|
|
|
void setMaxRound(int maxRound);
|
|
|
|
void setDistanceThreshod(float threshold);
|
2018-08-27 08:50:40 +00:00
|
|
|
int addNodeInOrder(const QVector3D &position);
|
2018-05-24 01:44:40 +00:00
|
|
|
void solveTo(const QVector3D &position);
|
|
|
|
const QVector3D &getNodeSolvedPosition(int index);
|
|
|
|
int getNodeCount(void);
|
|
|
|
private:
|
|
|
|
void iterate();
|
|
|
|
private:
|
|
|
|
std::vector<CCDIKNode> m_nodes;
|
|
|
|
QVector3D m_destination;
|
|
|
|
int m_maxRound;
|
|
|
|
float m_distanceThreshold2;
|
2018-06-11 14:24:25 +00:00
|
|
|
float m_distanceCeaseThreshold2;
|
2018-05-24 01:44:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|