Code Monkey home page Code Monkey logo

Comments (1)

TheComet avatar TheComet commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.