载入中...
搜索中...
未找到
Skeleton2D.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4#include <memory>
5
6namespace eve::ik {
7
8class Solver2D;
9
17public:
19 Skeleton2D();
22
23 Skeleton2D(const Skeleton2D &) = delete;
24 Skeleton2D &operator=(const Skeleton2D &) = delete;
25
27 int createBone(int parentId, float length = 1.f);
28
30 int getBoneCount() const;
32 int getRootId() const { return 0; }
34 int getParent(int boneId) const;
36 int getChildCount(int boneId) const;
38 int getChild(int boneId, int childIndex) const;
39
41 float getLength(int boneId) const;
43 void setLength(int boneId, float length);
44
46 void setPosition(int boneId, float x, float y);
48 float getX(int boneId) const;
50 float getY(int boneId) const;
51
53 void setOrientation(int boneId, float x, float y);
55 float getOrientationX(int boneId) const;
57 float getOrientationY(int boneId) const;
58
60 void setRotation(int boneId, float angle);
62 float getRotation(int boneId) const;
63
65 void setConstraints(int boneId, float minAngle, float maxAngle);
67 void clearConstraints(int boneId);
69 bool hasConstraints(int boneId) const;
70
72 void initStraightPose(float rootX = 0.f, float rootY = 0.f);
74 void bind();
76 void forwardKinematics();
78 void updateRotations();
79
81 float totalLengthTo(int boneId) const;
82
83private:
84 friend class Solver2D;
85 struct Impl;
86 std::unique_ptr<Impl> impl_;
87
88 void requireBone(int boneId) const;
89};
90
91} // namespace eve::ik
double y
double x
std::uint64_t parentId
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
float length
Script-facing 2D skeleton + pose state. Bone indices are stable after each createBone / topological r...
Definition Skeleton2D.h:16
~Skeleton2D()
Releases skeleton and pose state.
int getRootId() const
Root bone id (always 0).
Definition Skeleton2D.h:32
Skeleton2D & operator=(const Skeleton2D &)=delete
Skeleton2D(const Skeleton2D &)=delete
FABRIK solver for Skeleton2D. Script type: Solver2D.
Definition Solver2D.h:13