Comments (1)
Hey Peach1!
You are very welcome to give this a go.
static void
apply_hinge(ikreal_t delta_rotation[4],
const ikreal_t current_rotation[4],
struct ik_constraint_t* constraint)
{
/* write to delta_rotation */
}
The way this was supposed to work is you would check if the segment is within the constraint limits, and if it is not, you calculate what the rotation would need to be in order to move the segment back into the limit (delta_rotation
). current_rotation
would be the joint rotation in local coordinates, and constraint->hinge.(axis|min_angle|max_angle)
would be your constraint parameters (also in local coordinates).
Feel free to add or remove what you need from https://github.com/TheComet/ik/blob/devel/ik/include/public/ik/constraint.h#L33
If you look at https://github.com/TheComet/ik/blob/devel/ik/src/solver_fabrik.c you will see solve_chain_forwards
and solve_chain_backwards
. These are the variants that don't consider constraints. There are another two functions called solve_chain_forwards_with_constraints
and solve_chain_backwards_with_constraints
that would be called if the IK_ALGORITHM_CONSTRAINTS flag is set. They're basically copies of the non-constraint versions, except that they need to transform the current node from global to local space before applying the constraint, and then transform the node back into global space so the algorithm can continue.
This part doesn't work at all yet. If you want you can rewrite those two functions from scratch.
I think that's all I can offer for now. I've had very little time to work on this unfortunately, I'm not sure whether the devel branch even works properly. I recall leaving the project in a mess where nothing works, so if you have issues you should probably switch to master and I'll work on merging the fixes from devel.
Do you have Discord? I'm TheComet#5387
from ik.
Related Issues (20)
- How to set and get the rotation of each joint HOT 7
- Running the example code HOT 3
- Correct sample
- How work "eff->target_position"? HOT 3
- IK_TWO_BONE work, IK_FABRIK - failed HOT 4
- Need some samples with constraint HOT 6
- Obtaining Joint Angles
- mark
- Solved
- the algorithm is diffcult to use HOT 1
- should iterate_affected_nodes be used ? HOT 1
- SetLocalPosition undefined HOT 1
- where is the v2.0 code HOT 1
- how to use the interface HOT 8
- Target has an offset when setting chain_length HOT 2
- Better Documentation for Building HOT 1
- Cannot compile sample code HOT 4
- Remove lib prefix only if IK_PYTHON=ON
- Is your project related to effector? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ik.