Moving a bone along a spline curve

77 views Asked by At

I have a B-spline curve that I want a rigid bone to move along, and I want to calculate the inverse kinematics of one end of the bone when I move the other end. Both ends of the bone should lie on the curve, and the length of the bone should stay consistent. I have the necessary functions to convert B-spline curve into other parametric curves like Bézier curves. How should I go about tackling this problem?

Example scenario:

Initially spline with bone:

spline with bone

After some time spline with bone moved:

spline with bone moved

These images are done with manually moving the points, so the bone length is not consistent. However for the calculated result it should be.

Currently what I am looking at is first pin down the head of the bone, then draw a circle centered at the head with radius of the bone length, and find intersections between the circle and the spline. I found chapter 7.3 of Computer Aided Geometric Design by T. W. Sederberg describing intersection between parametric curve and implicit curves, which seems to fit my needs, but I'm unsure how to apply it to my problem, and how to efficiently solve for the polynomial roots.

Context: I am making a 2D vector animation engine for my own use. The front end is JavaScript and html5 canvas in a browser, and the calculation part is done in Rust compiled into WASM.

0

There are 0 answers