Easing along parametric curves part I

Over the holiday weekend, I hope to work on a demo illustrating how to apply easing to animating a sprite along a path represented by a parameteric curve. The specific curve will be a cubic Bezier. I’ve talked about velocity control in path animation in the past and the importance of arc-length parameterization. These concepts are illustrated in this demo and this demo.

Without arc-length parameterization, applying easing to path animation along a Bezier produces inconsistent motion that is a function of control-point placement. This can be seen in the following diagram.

Uniform vs. arc-length parameterzation, t = s = 1/2
Uniform vs. arc-length parameterzation, t = s = 1/2

Both cubic Bezier curves have the same geometry; they are offset vertically for demonstration purposes. The top curve is uniform parametrized and illustrates what would be obtained from any tweening library using Bezier curves. The bottom curve is arc-length parameterized. Both red and green markers are placed at a parameter value of 0.5 with no easing (equivalent to Linear easing with b = 0 and c = 1). Notice that the green marker is halfway along the length of the curve. A sprite moving along that curve moves at uniform velocity, as if the entire curve were a straight line and linear interpolation (tweening) was applied.

In the upcoming update of Singularity, the Penner easing functions are implemented in AS3 as an easing factory, conforming to a standard Interface. The easing demo will illustrate a few different types of easing applied to the above curves, highlighting the need for arc-length parameterization to properly apply easing in the path animation.

Hope you enjoy the upcoming holiday if you’re celebrating it!

Jacobian and IK

Not sure where this came from, but I received three e-mails yesterday asking ‘what is a Jacobian,’ one of which wanted to know how it was used in IK. When something is asked multiple times, I try to respond in the blog and my first response is always check Wikipedia for a basic definition. Way oversimplified, a Jacobian is a matrix of first partial derivatives. For IK, its construction allows a convenient representation of the change in end-effector position given a change in joint angles. Practical application is considerably more complex. You can get a good introduction here.

If your goal is to implement IK in Flash (perhaps Papervision), I would not use this approach. For most humanoid (bipedal) characters, a good limb solver will go a long way and you are better off thinking about multi-chain solvers. RFK or CCD are good (and much simpler) alternatives and there is a reasonable starting point in Peters’ Making Things Move book.

Singularity also has a set of rigging classes (in-plane solvers), including a limb solver with joint constraints. Even if your goal is IK in PV3D, working with in-plane solvers is a good starting point. My FITC 2007 presentation, Dynamic Skeletal Animation can be downloaded here. The presentation discusses FK and IK, and has several demos, including mixed IK-FK.

Enjoy and good luck with your IK efforts!

Honda Fit Sport First Road Trip

As a follow-on to this post and this post, I took the Fit Sport on my first road trip this weekend, visiting in-laws in east Texas. Not a very long trip, but at least I was able to push the speedometer up to 70 for a while. About 90% local freeway and interstate driving; the rest was city. Driving conditions were ideal; flat roads and no wind. It was cool enough in the morning that I only ran the A/C intermittently on the outbound leg of the trip.

Mileage for the entire trip was 39.45. On the freeway, I kept the cruise control at the posted speed limit (which varied from 60-70). As a rough guess, I suspect the average highway speed was about 64mph, so this is not indicative of what would be achieved on a longer trip where average speeds were 70+. Still, I was very impressed with the result. In similar conditions, my Escape Hybrid achieved 30.5 mpg, although that would quickly drop above 70 mph and any type of head or cross-wind.

Getting Started with Papervision GW

If you’re just starting out with Papervision or migrating to Great White after having been away from PV3D for a while (that’s me), here are a couple links to demos and getting started tutorials you may find helpful.

http://www.dehash.com/?page_id=139 – over a dozen demos, with source code.

http://tartiflop.blogspot.com/2008/07/first-steps-in-papervision3d-part-1.html – First steps in Papervision Part 1

http://tartiflop.blogspot.com/2008/07/first-steps-in-papervision3d-part-2.html – First steps in Papervision Part 2


PureMVC Multicore

Haven’t had the chance to use PureMVC in a while, although the compensation is that I get to do some cool math at my current gig. When possible, I try to keep up with developments in the PureMVC field. The MultiCore implementation where the core actors are implemented as Multitons, not Singletons is very interesting. Messaging between cores is implemented via a pipes utility.

Here are a few links to get you started in these areas.

HelloPipes tutorial using MultiCore and Flex Modules.

PipeWorks MultiCore demo.

MultiCore Framework demo.

MultiCore app. demo without Flex Modules.

Things to watch for when porting from PureMVC to PureMVC MultiCore.

Honda Fit Sport Update

As a follow-on to this post, I’m now filling up every half tank. My two previous half-tank results have been 35.2 mpg and 35.4 mpg. A bit more local freeway driving on these two, so I’m getting the benefit of the highway mileage. I should point out again that I’m a very conservative driver and focus on economy when getting from point A to point B, not time. So, my results are probably at the high end of expectations.

In terms of total cost of ownership and general driving enjoyment, this has been one of the best vehicles I’ve owned to date.