Script-facing 2D skeleton + pose state (ik::skeleton2d + ik::ecs2d). Bone indices are stable after each createBone / topological refresh. Root bone is always id 0. 更多...
#include <Skeleton2D.h>
Public 成员函数 | |
| Skeleton2D () | |
| Creates an empty 2D skeleton with a root bone. | |
| ~Skeleton2D ()=default | |
| Releases skeleton and pose state. | |
| Skeleton2D (const Skeleton2D &)=delete | |
| Skeleton2D & | operator= (const Skeleton2D &)=delete |
| int | createBone (int parentId, float length=1.f) |
| Create a child bone under parentId; returns new bone id. | |
| int | getBoneCount () const |
| Number of bones currently in the skeleton. | |
| int | getRootId () const |
| Root bone id (always 0). | |
| int | getParent (int boneId) const |
| Parent bone id, or -1 for the root. | |
| int | getChildCount (int boneId) const |
| Number of direct children of boneId. | |
| int | getChild (int boneId, int childIndex) const |
| Child bone id at childIndex under boneId. | |
| float | getLength (int boneId) const |
| Rest length of the bone. | |
| void | setLength (int boneId, float length) |
| Sets the rest length of the bone. | |
| void | setPosition (int boneId, float x, float y) |
| Sets the world-space bone position. | |
| float | getX (int boneId) const |
| World-space X of the bone (or component). | |
| float | getY (int boneId) const |
| World-space Y of the bone (or component). | |
| void | setOrientation (int boneId, float x, float y) |
| Sets the bone forward orientation vector. | |
| float | getOrientationX (int boneId) const |
| Orientation vector X. | |
| float | getOrientationY (int boneId) const |
| Orientation vector Y. | |
| void | setRotation (int boneId, float angle) |
| Local hinge angle (radians) relative to parent forward. | |
| float | getRotation (int boneId) const |
| Local hinge angle in radians. | |
| void | setConstraints (int boneId, float minAngle, float maxAngle) |
| Joint limits for the single 2D hinge DOF. | |
| void | clearConstraints (int boneId) |
| Removes joint limits from the bone. | |
| bool | hasConstraints (int boneId) const |
| True if the bone has joint limits. | |
| void | initStraightPose (float rootX=0.f, float rootY=0.f) |
| Initializes a straight chain pose from the root. | |
| void | bind () |
| Binds the current pose as the rest pose. | |
| void | forwardKinematics () |
| Updates world positions from local rotations. | |
| void | updateRotations () |
| Derives local rotations from world positions. | |
| float | totalLengthTo (int boneId) const |
| Sum of bone lengths from root to boneId inclusive. | |
| ::ik::skeleton2d & | native () |
| ::ik::ecs2d & | state () |
| const ::ik::skeleton2d & | native () const |
| const ::ik::ecs2d & | state () const |
详细描述
Script-facing 2D skeleton + pose state (ik::skeleton2d + ik::ecs2d). Bone indices are stable after each createBone / topological refresh. Root bone is always id 0.
在文件 Skeleton2D.h 第 14 行定义.
构造及析构函数说明
◆ Skeleton2D() [1/2]
| eve::ik::Skeleton2D::Skeleton2D | ( | ) |
Creates an empty 2D skeleton with a root bone.
在文件 Skeleton2D.cpp 第 7 行定义.
◆ ~Skeleton2D()
|
default |
Releases skeleton and pose state.
◆ Skeleton2D() [2/2]
|
delete |
成员函数说明
◆ bind()
| void eve::ik::Skeleton2D::bind | ( | ) |
Binds the current pose as the rest pose.
在文件 Skeleton2D.cpp 第 171 行定义.
◆ clearConstraints()
| void eve::ik::Skeleton2D::clearConstraints | ( | int | boneId | ) |
Removes joint limits from the bone.
在文件 Skeleton2D.cpp 第 155 行定义.
◆ createBone()
| int eve::ik::Skeleton2D::createBone | ( | int | parentId, |
| float | length = 1.f |
||
| ) |
Create a child bone under parentId; returns new bone id.
在文件 Skeleton2D.cpp 第 43 行定义.
引用了 eve::ui::WidgetDesc::id, length, parent , 以及 parentId.
◆ forwardKinematics()
| void eve::ik::Skeleton2D::forwardKinematics | ( | ) |
Updates world positions from local rotations.
在文件 Skeleton2D.cpp 第 177 行定义.
◆ getBoneCount()
| int eve::ik::Skeleton2D::getBoneCount | ( | ) | const |
Number of bones currently in the skeleton.
在文件 Skeleton2D.cpp 第 56 行定义.
被这些函数引用 eve::particles::ParticleEmitter::attachToSkeleton2D().
◆ getChild()
| int eve::ik::Skeleton2D::getChild | ( | int | boneId, |
| int | childIndex | ||
| ) | const |
◆ getChildCount()
| int eve::ik::Skeleton2D::getChildCount | ( | int | boneId | ) | const |
Number of direct children of boneId.
在文件 Skeleton2D.cpp 第 68 行定义.
◆ getLength()
| float eve::ik::Skeleton2D::getLength | ( | int | boneId | ) | const |
Rest length of the bone.
在文件 Skeleton2D.cpp 第 82 行定义.
◆ getOrientationX()
| float eve::ik::Skeleton2D::getOrientationX | ( | int | boneId | ) | const |
Orientation vector X.
在文件 Skeleton2D.cpp 第 122 行定义.
◆ getOrientationY()
| float eve::ik::Skeleton2D::getOrientationY | ( | int | boneId | ) | const |
Orientation vector Y.
在文件 Skeleton2D.cpp 第 128 行定义.
◆ getParent()
| int eve::ik::Skeleton2D::getParent | ( | int | boneId | ) | const |
◆ getRootId()
|
inline |
Root bone id (always 0).
在文件 Skeleton2D.h 第 30 行定义.
◆ getRotation()
| float eve::ik::Skeleton2D::getRotation | ( | int | boneId | ) | const |
Local hinge angle in radians.
在文件 Skeleton2D.cpp 第 140 行定义.
◆ getX()
| float eve::ik::Skeleton2D::getX | ( | int | boneId | ) | const |
World-space X of the bone (or component).
在文件 Skeleton2D.cpp 第 104 行定义.
◆ getY()
| float eve::ik::Skeleton2D::getY | ( | int | boneId | ) | const |
World-space Y of the bone (or component).
在文件 Skeleton2D.cpp 第 110 行定义.
◆ hasConstraints()
| bool eve::ik::Skeleton2D::hasConstraints | ( | int | boneId | ) | const |
True if the bone has joint limits.
在文件 Skeleton2D.cpp 第 160 行定义.
◆ initStraightPose()
Initializes a straight chain pose from the root.
在文件 Skeleton2D.cpp 第 165 行定义.
◆ native() [1/2]
|
inline |
在文件 Skeleton2D.h 第 81 行定义.
被这些函数引用 eve::ik::Solver2D::solve() , 以及 eve::ik::Solver2D::step().
◆ native() [2/2]
|
inline |
在文件 Skeleton2D.h 第 83 行定义.
◆ operator=()
|
delete |
◆ setConstraints()
| void eve::ik::Skeleton2D::setConstraints | ( | int | boneId, |
| float | minAngle, | ||
| float | maxAngle | ||
| ) |
Joint limits for the single 2D hinge DOF.
在文件 Skeleton2D.cpp 第 146 行定义.
◆ setLength()
| void eve::ik::Skeleton2D::setLength | ( | int | boneId, |
| float | length | ||
| ) |
◆ setOrientation()
| void eve::ik::Skeleton2D::setOrientation | ( | int | boneId, |
| float | x, | ||
| float | y | ||
| ) |
◆ setPosition()
| void eve::ik::Skeleton2D::setPosition | ( | int | boneId, |
| float | x, | ||
| float | y | ||
| ) |
◆ setRotation()
| void eve::ik::Skeleton2D::setRotation | ( | int | boneId, |
| float | angle | ||
| ) |
◆ state() [1/2]
|
inline |
在文件 Skeleton2D.h 第 82 行定义.
被这些函数引用 eve::ik::Solver2D::solve() , 以及 eve::ik::Solver2D::step().
◆ state() [2/2]
|
inline |
在文件 Skeleton2D.h 第 84 行定义.
◆ totalLengthTo()
| float eve::ik::Skeleton2D::totalLengthTo | ( | int | boneId | ) | const |
Sum of bone lengths from root to boneId inclusive.
在文件 Skeleton2D.cpp 第 189 行定义.
◆ updateRotations()
| void eve::ik::Skeleton2D::updateRotations | ( | ) |
Derives local rotations from world positions.
在文件 Skeleton2D.cpp 第 183 行定义.
该类的文档由以下文件生成:
- src/modules/ik/Skeleton2D.h
- src/modules/ik/Skeleton2D.cpp