Adobe, MAKE SOME NOISE

Equations Which I Know And Love.
This term was passed down from my highschool physics teacher. It is a great misnomer. This page is a running list of equations, algorithms, and things otherwise mathematickal.

Point Conversion

{Rectilinear, Cartesian, Degrees, Radial, Polar, Radians, Vector}

Cartesian Coordinate: (x, y)
x = distance from the origin horizontally
y = distance from the origin vertically

Polar Coordinate: (r, θ)
r = radius: distance from origin
θ = theta: angle from origin (generally ccw from 3 O'clock).

Ordinate Conversion
x = r • cos(θ)
y = r • sin(θ)
r = √(x² + y²)
θ = tan⁻¹(y ÷ x)

note: in ActionScript, there are two inverse tangent functions, use Math.atan2(y, x) for this equation.

Angle Conversion

{Degrees, Radians, Angles}

radians = degrees • (θ ÷ 180)
degrees = radians • (180 ÷ θ)

Point Relationships

{Distance, Midpoint, Rise, Run}

MidPoint
x = (x₀ + x₁) ÷ 2
y = (y₀ + y₁) ÷ 2

Distance between two points
x-distance (run) = x₁ - x₀
y-distance (rise) = y₁ - y₀
combined = √( run2 + rise2 )

Quadratic Bezier Curves

{3-point curve, anchor, control}

Coordinate along the curve

ƒᵪ = (1 - x)² • A₀ + 2x(1 - x) • C + x² • A₁

0 <= x <= 1 (ie. % of the way from A₀ to A₁).
A₀ is the x or y value of the first anchor
A₁ is the x or y value of the second anchor
C is the x or y value of the control point
This equation works for both x and y position

curves1.gif

A brief note: Bézier curves can be expressed in two ways, Quadratic and Cubic. Quadratic curves, use two end points A₀ and A₁ and a control point C. This is the method Flash uses to render curves. Alternately, a second Control point can be added, as in programs like Illustrator. The preceeding equation is specific to quadratic curves. There is much (much) more information about the makeup and nature of bezier curves on the wikipedia page.

4 Responses to “EWIKAL”

  1. honi Says:

    In the Angle Conversion, would the symbol ? be PI?

  2. honi Says:

    The synbol got garbled. I’m referring to:
    radians = degrees • ([THIS ONE] ÷ 180)

  3. Rob Says:

    Hrm – the symbols are rendering alright for me but I’ll take a look on some other environments and see if I can’t figure out what’s up.

    In the two Angle Conversion equations, the symbol is Theta (a circle with a line through it) – which is the measure of the angle that you’re trying to convert. To clarify:

    radians = degrees * (_theta / 180)
    degrees = radians * (180 / _theta)

    You can also just grab the code for these formulae from the bottom of my code page here: http://www.calypso88.com/?page_id=21

  4. preereitasaf Says:

    Bravo , good post! Amigo!

Leave a Reply