### Archive

Archive for August, 2009

## Quadratic Hermite Curves Part 3

In part 2 of this series, we looked at the geometric interpretation of the end tangent of the quadratic Hermite curve.  There was an issue in terms of relating the vector endpoints in the parent coordinate system to the tangent vector that is computed based on delta-x and delta-y from the point P0.  Compensating for this issue was necessary in order to draw the tangent vector.

I also suggested computing a unit vector in the direction of the tangent as an exercise so that it could be drawn at constant length.  The two questions addressed in this post are

1) Do we constantly have to adjust for the deltas between T and P0 in order to draw a tangent to the curve at any parameter value in [0,1]?

2) How exactly do we compute a unit vector in the tangent direction and draw a constant-length tangent segments?

The answer to question 1 is no.  The compensation, if you want to call it that, is already accounted for in the polynomial coefficients which are computed based on the delta-x and delta-y between T and P0.  So, we can use P'(t) = b + 2ct (review the computation of the ‘b’ coefficient in the code).  In part 2, we substituted for b and c in terms of the endpoints of the original vectors.  Once the polynomial coefficients are computed, we can use them directly for the derivative at any parameter value.

This raises the question of why part 2 in the first place?  The geometric formula for the end tangent in terms of the original points (and T) will be important in part 4 when we discuss joining quadratic  Hermite segments.

For question 2, the unit tangent vector is P(t)/||P(t)||, where ||.|| is the vector 2-norm.  Let dx = x'(t), dy = y'(t), and ux = x-component of unit tangent vector, uy = y-component of unit tangent vector.

Then, we can write

ux = dx/sqrt(dx*dx + dy*dy)

uy = dy/sqrt(dx*dx + dy*dy)

Since this is a unit vector, multiply by any amount to draw a constant-length vector of that amount.  For example, to draw a tangent segment of 40px length,

moveTo( x(t), y(t) ), then lineTo( x(t)+40*ux, y(t) + 40*uy )

This concept is illustrated in a simple demo, a screenshot of which is shown below.

Tangent to a quadratic Hermite curve

The slider adjusts the parameter value for the tangent segment between 0 and 1. (As an aside, these demos require the F10 player).

In the next post in this series, we will see how to join two quad. Hermite curves with continuity at the join.  In the mean time, think about what is the maximum continuity that could possibly be enforced at a join point?  Hint:  What degree is the derivative of a quadratic polynomial?

Categories: Flash, Math

## Elliptical Arcs for Aribtrarily Rotated Ellipse

I’ve received a few requests over the last several weeks for methods to approximate elliptical arcs with quad. Beziers for an ellipse that is rotated at an arbitrary angle.  Further, the requests were for straight actionscript; no Flex and no Degrafa.  Oh well, not as fun, but your wish is my command 🙂

I originally worked with this algorithm for a cubic Bezier approximation in a computational geometry class in 1981.  I don’t have an original attribution for the algorithm, but suspect it goes back to the 1970’s.  Fortunately, the quad. case is easier, although strict error analysis is still tricky.  For ellipses with major/minor axes of a few hundred px, it seems that approximating the arc in segments spanning no more than PI/8 is an acceptable starting heuristic.  You may need something more sophisticated for much larger cases.

A screenshot of the demo (Flash CS3) is shown below.  The code is straight AS on the timeline; no frills, no classes, just a straightforward implementation of the algorithm.

Approximating an arc of a rotated ellipse

The code draws a simple wedge.  You can download it here.  If there is sufficient interest, I might incorporate this into Degrafa (whose elliptical arc class does not take rotation into account if memory serves).

Enjoy!

Categories: Flash, Math Tags: , , , ,

## Babolat Revenge Review Part 1

This is the first in a two-part review of the new Revenge string from Babolat.  I currently play a VS Team 16/Pro Hurricane Tour 17 hybrid, so I’m reviewing Revenge both fullbed and in a hybrid.  I normally string in the 50-53 range, so I first tried Revenge 17  in a fullbed @ 54lb.

I had previously tested Pro Hurricane Tour and xCel Power as a fullbed in the same racquet, both at an average tension of 53.  The xCel Power felt great but had a tendency to spray balls.  It was better crossed with xCel Premium.  The Pro Hurricane tour was so responsive in my head-light racquet that it had some low-frequency vibration that was very noticeable on touch shots and light volleys.  Crossed with the VS Team gut, however, performance is terrific in a hybrid.

My first impression of Revenge was that it was a cool-looking (red) string with a unique popping sound at impact.  At lower tension, the string provided expected power on groundstrokes but with unexpected control.  This is one string you can take a hard swing at the ball and if you miss, it’s all on you.  While not advertised as a comfort string, I did not notice any arm soreness after hammering on the string with 4.0/4.5 players for about an hour.

Volleys were very crisp and it almost seemed like the string performed better at the net than on the baseline.  If you have a relatively flat first serve, you will probably upgrade your first serve with Revenge.  Spin was definitely weaker than Pro Hurricane Tour (as would be expected) and from what I remember hitting with xCel Power.  You might lose a bit on a sliced second or heavy topspin first serves.

Coming from a gut player, my next observation is almost predictable.  Revenge does not have the feel I like on touch shots.  If these are an important part of your game, then you will not like this string in a fullbed.

After about 3 1/2 hours of hitting under various circumstances (including in the middle of the day in Texas heat), there was very little string movement.  The person who strung my racquet indicated no issues in the stringing and little coil memory.  DIY’ers will probably find it an easy job to string.

Overall, this string impresses me as good choice for 3.0/3.5 players looking for a power string without sacrificing control.  Revenge is advertised as a highly durable string with minimal tension loss.  That means you can afford to string at lower tensions without fear of the string becoming mushy after just a couple weeks of hard play (which happened to me with xCel Power).  I will continue to hit with the string and once I get to about ten hours, I’ll measure the tension and report back.

I believe 4.0+ players might consider Revenge as an alternative to say Big Banger, but only from the standpoint of adding control or getting a more arm-friendly string.  If you currently play a hybrid (especially a gut/poly hybrid), you would only want to consider Revenge as a substitute for your mains.  When my current hybrid is ready for restringing, I’ll see how Revenge compares as a main string to the Pro Hurricane Tour and then post part 2 of this review.

Categories: Tennis Tags: , ,

## Tennis Tip: Catch the Ball for Better Volleys

I don’t have an original attribution, but someone once said that a good volley motion is similar to catching a baseball.  A fielder does not swing their arms towards the ball.  The arm is extended outward to place the glove in a position to intercept the ball.  Instead of a baseball glove, perhaps a Lacrosse stick is a better visualization.  Think of the racquet face as something you might use to simply catch the ball.  There is no need for a swinging motion as the ball’s momentum will supply sufficient power.

For isntances where you want to supply more power to volley a softer shot, use shoulder rotation to move the racquet towards the ball, keeping it positioned in front of you.

You can practice this technique by having someone feed you short balls and catch them with your hand.  Think about duplicating this motion with an actual volley and it may help you overcome that swinging instinct that leads to inconsistency.

Good luck with the game!

Categories: Tennis

## Quad Hermite Curves Part 2

In the previous post, we saw how to construct a quadratic curve from two points and a start tangent.  If the eventual goal is to join one or more of these segments, we need to know how to compute the end tangent.  Note from the prior post that the curve’s derivative is P’(t) = b + 2ct, with b = T and c = P1 – P0 – T.  From this, we have P'(t) = T + 2(P1 – P0 – T)t .  The end tangent occurs at t = 1, so P'(1) = 2(P1-P0) – T.  The geometric interpretation of this formula is illustrated in the following diagram.

End Tangent of Quadratic Hermite Curve

The constituent elements of the formula are illustrated with dashed lines (courtesy of a Degrafa decorator).  At first glance, it seems that the vector 2(P1-P0) – T is not at all tangent to the curve at P1.  Recall that with Hermite curves, the tangents are typically described relative to a parent coordinate system.  In the computations, the tangent is computed relative to the first interpolation point.  The endpoint of 2(P1-P0) – T is used to create delta-x and delta-y values from P0.  These deltas are added to P1 to draw the actual tangent vector, illustrated in red.

In the online demo, you may move either P0, P1, or T and see each element of the construction (without labels).  The length of the tangent segment varies based on the deltas.  As an exercise, try computing a unit vector in the direction of the tangent and draw it with constant length.

There is an issue with the dash line decorator in terms of altering the dash width and spacing.  I did not write the decorator, so I’m not familiar with the internals.  If time allows, I will look into it.  In the mean time, study the code and in the next post of this series, we’ll look at the general tangent to the curve in more detail.  After that, we will see how to join two quadratic Hermite segments with continuity at the join.

View demo

View source

Categories: Degrafa, Flex, Math Tags: , , ,

## Quad Hermite Curves Part 1

A quadratic Hermite curve is constructed with two points (P0 and P1) and a tangent vector, T, as shown in the following diagram.

Construction of a quadratic Hermite curve

The tangent vector may be either a start (out-tangent) or end (in-tangent) vector, although it is customary to make it a start-tangent.  This type of curve is rarely used in curve construction as quad. Beziers  are often preferred when one is designing with a quadratic curve.  One advantage to this type of curve segment (that we will exploit in the future) is the simplicity of its construction.

The quadratic curve is of the form P(t) = a + bt + ct2 . The derivative is of the form, P'(t) = b + 2ct. Three equations are needed to compute the coefficients, a, b, and c. There are given by P(0) = P0, P(1) = P1, and P'(0) = T. The solution to the 3×3 system of equations is

a = P0

b = T

c = P1 – P0 – T

When computing the coefficients, the tangent vector is constructed using P0 as an origin.  Given the endpoint in the parent coordinate system, the delta between T and P0 is used in the computations.  This is illustrated in the accompanying demo.

In subsequent posts, we will look at the end tangent and how these quadratic segments can be joined (with continuity).

Categories: Flex, Math Tags: , ,

## Tennis Tip: Maintain Posture Through Impact

I think it was David Leadbetter who popularized the saying in golf of letting the dog wag the tail, not have the tail wag the dog.  The idea behind the saying was to let the larger muscles in the body control the movement of the smaller muscles, not react to their motion.  In other words, the hands and arms do not start the backswing in golf; they react in unison to movment in the larger back muschles.  The so-called ‘one-piece’ takeaway was thus popularized.

The tennis swing bears some similarity.  So many swings I study are dominated by arm motion.  The hips, back, and legs seem to come along for the ride.   This is very evident in the motion at and through impact.  I see people trying to put ‘body english’ on the ball to complete the stroke.

The two most common moves are standing up at impact and throwing the body around (particularly on the forehand side) just before impact.  The former move often comes from a psychological desire to add more height to the ball.  The latter move is often an attempt to direct the ball crosscourt or add more power.  In golf, we would call this coming ‘over the top.’  The downswing is started by ‘throwing’ the arms from the top, then the body tries to compenste by pulling around and to the left, which only throws the clubhead even further outside the swing path, causing an outside-to-in motion.  With an open clubface, this produces a slice; a pull results from a closed clubface.

In either case, we should not be using the upper body to ‘add’ to arm motion at impact.  The upper body should be positioned prior to impact.  Its role in the swing is one of stabilization and being part of the total kinematic chain.  If the body is rapidly rotated back around during impact, the racquet face is either closed or starting to close, so the result is a flatter swing path that has a tendecy to direct the ball downward.  With perfect timing, the ball can be hit low and hard, but net balls are a common result.  The compensation is additional body motion by raising and over-rotating at impact.  This causes the ball to often miss wide crosscourt or long.

Stroke inconsistency can often be traced to short-circuiting the kinematic chain, moving the arms too much and trying to compensate with body motion at impact.  With sufficient time to setup and hit a ball in the strike zone, the body should appear to rotate around the spine at impact with a relatively still head.  We see this so well in Federer’s strokes.  The body posture is formed prior to impact and remains relatively constant through impact as the kinematic chain is unwound.

Getting rid of body compensations takes some effort and I suggest you work with a professional instructor.  Identifying specific  compensations and setting up drills to alleviate the issue is important.  Two people that have apparently similar compensations may need completely different remedial action.  For example, I have a tendency to shift the body laterally back towards midcourt.  My instructor identified this as an attempt to recover too quickly and get into  position for the next shot.  So, we do lots of crosscourt drills where the goal of the drill is to maintain strict posture and consistently hit the ball back hard and deep (we usually try for 8-10 straight).

In golf, we used to say that you ought to be able to take a practice swing and see your left shoulder go under the chin on the backswing and see the right shoulder go under the chin after impact.  Take a practice swing with your racquet and look at your shoulders.  Do you really get the feel of pivoting around your spine?  Do the arms act in response to motion in the hips and shoulders or does the upper body react to motion in the arms?  Is the dog wagging the tail or the tail wagging the dog?

Good luck with the game!

Categories: Tennis Tags: ,