2D Tangents in Bezier Splines

I am working on a custom Collada importer. I am using Seymour sample for testing skinned characters, but I’m royally confused about the Bezier spline definitions in the two available animations.

Specifically, I can’t figure out what in-tangents and out-tangents and their x-y components correspond to, in case of two dimensional tangents (like the ones in Seymour_anim2.dae).

My apologies in advance as I’m probably missing something really obvious here.

Just as I suspected, I was completely clueless :oops:

After a cruise through the Feeling ColladaMaya forums, I stumbled upon a post by Guillaume Laforte, which precisely answered my question. I include it here in my post for the curious.

Let the Bezier formula for 2D curves be:

B(t) = (1-t)^3 * V0 + t * (1-t)^2 * V1 + t^2 * (1-t) * V2 + t^3 * V3.

Let the two dimensions be (time and X).

In the data exported from ColladaMaya, for the spline segment ‘i’:
{ OUTPUT[i], INPUT[i] } = V0.
IN_TANGENT[i+1] = V2.
{ OUTPUT[i+1], INPUT[i+1] } = V3.

Note that OUT_TANGENT and IN_TANGENT are 2D values already.
Note that if your animation curve has ‘n’ segment, then OUT_TANGENT[n] and IN_TANGENT[0] are included in the data but never used.

To correctly animate along this 2D bezier spline, you’ll have to do it in two steps:

  1. Using the Bezier formula in the time-dimension, and replace B(t) by the current time, find the value of ‘t’. It is suggested to use an iterative process where you attempt with many values of ‘t’ and keep the only which gives you the closest answer for B(t).
  1. Using the Bezier formula in the X-dimension and the value of ‘t’ calculated in step 1, find B(t) which is the animation spline result.

Yes, that’s right.
You can use a dichotomy for the search, such as in de Casteljau Subdivision.

You can also memorize all the tests done in the (while loop) in a tree, to accelerate the next search.