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.
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!
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!
In case you haven’t heard, Club Penguin hired Rober Penner away from Adobe. First of all, congrats to Robert on the new position. In case you would like to work with him, they have another position open; more at Rob’s blog here.
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.
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
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.
MultiCore app. demo without Flex Modules.
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.
I thought Blake should have been in the final, but that’s another discussion for another time. Probably would not have made any difference in the outcome. Nadal continues a streak that I can only compare to what Tiger achieved in winning four consecutive majors (although not in the same calendar year). Phelps’ performance during the Olympics has been nothing short of astonishing, but Nadal’s accomplishment over a longer period of time against a competitive field, across multiple surfaces almost defies comparison.
One wonders if there will be any drama at all this year during the US Open or will it be just another notch in Nadal’s belt? And, what’s the deal with biting each medal or trophy?
The first pass at porting the classic Graphic Gem algorithm for closest point on a Bezier is complete and it works for both quadratic and cubic Beziers (the original Gem C code was hardcoded for cubics). This algorithm has important pedagogical significance beyond just being included in the Gems series. The embedded Bezier root finder illustrates practical application of geometric properties of Bezier curves, so I expect this to be a useful teaching tool.
The code is not a straight port; method names and function signatures were changed to meet longer-term goals. The code will be optimized in a subsequent release of the BezierUtils class. During the process, I noticed a typo in the Graphic Gems book describing the algorithm, so I expect a TechNote is in order. This will serve as a segway into discussions on dealing with cusps, alternate optima, and a comparison of root finders in Bezier vs. Power form (as well as a discussion on Lane’s algorithm). Alternate approaches to the problem as well as an extension to Bezier splines are on the table for future development.
There are two online demos, one for quadratic curves and the other for cubics. The updated Singularity package may be downloaded from links on either page. MXML files for the demos are provided in the download.
So, another tournament, another early exit for Federer. Although I was glad to see an American (James Blake) win, it is always difficult to watch the slow decline of a great champion. They say the fall from the top is always the hardest. Some have speculated that Rodger’s timing has eroded with age and that some of his errant shots could be alleviated by switching to a mid-plus racquet. There may be some truth to that assertion, but it’s hard to see Rodger switching from the K 6.1 any time soon.
Anyway, I suspect that some of the physical issues stem from not completely recovering from mono earlier in the year. The biggest problems for him appear to be mental. He no longer projects an image of invincibility on the court. Even the slightest hint of vulnerability in a highly competitive field can be a huge liability. Then, there is basic concentration. Jimmy Connors once said that he was unable to break into the top ten in the world regardless of his physical level of play until he made a dramatic reduction in the number of mental errors and concentration lapses per match.
I hope Rodger turns it around, especially at the US Open. I believe he has a lot of great tennis left in him and I would also like to see the Federer-Nadal rivalry continue and at a high level of play.