# Parabolic Scaling

This is a variation on a problem submitted to me recently.  I suspect the original question related to scaling an object moving in a circular, elliptical, or some other path parameterized on an angle that varies between zero and pi.  The scaling is applied in Actionscript and must satisfy the following criteria (Let S(θ) = scale factor at the angle, θ).

S(0) = 1/4

S(∏/2) = 3/4

S(∏) = 1

S(3∏/2) = 3/4

S(2∏) = 1/4

The question is how to derive a formula for the scaling that satisfies these conditions.  This is the opposite of a more common situation in which one is given a functional representation and required to derived the necessary function parameters.  In this case, we are given conditions but no direction on an appropriate functional representation.  In such a case, we are free to choose the function.  Actual choice may depend on aesthetic or other considerations.

First, notice the symmetry about pi.  The problem can be reduced to one of finding a functional representation of S(θ) in [0,∏] If the input angle is greater than ∏, we can use reflection to generate the angle that is input to the scale function.

For purposes of illustration, a polynomial representation for S is used.  Three conditions are provided in [0,∏], providing three degrees of freedom in selecting function parameters.  This allows a quadratic polynomial to be used to represent S, i.e.

S = a + bθ + cθ2

The three coefficients a, b, and c are determined from the three conditions

S(0) = 1/4

S(∏/2) = 3/4

S(∏) = 1

The first condition implies a = 1/4, leaving us with two equations in two unknowns,

1/4 + b(∏/2) + c(∏2/4) = 3/4

1/4 + b∏ + c∏2 = 1

I won’t crank through all the math here (if too many people have problems, I’ll post the complete derivation later).

The solution is b = 5/4∏ and c = -1/2∏2

In the code, the angle should be reduced to [0,2∏]. If the reduced angle is greater than ∏, reflect about ∏ to create the actual θ value to input to the formula

s = a + b*(θ + c*(θ))

which evaluates the polynomial in nested form. The parabolic representation of scale is only one possible solution to this problem. If the input scale factors vary, it is possible to use Cramer’s rule, for example, to dynamically solve for the necessary coefficients.