The formula is straight forwards, 'elegant' as a collegue just remarked. The theory behind is it is just mind-numbing so I'll leave the docmentation and graphics till later.
The formula used conventional trigonometry, the kind of mathmatics the ancient Greeks would be damn familiar with. Unfortunately, I'm not that old and it took me a while before I stumbled upon the right solution.
The only key thing to remember is the maximum velocity of any move is 100%. In the formula, 100% has a value of 1. If you want to join the fairing up to a linear move with a velocity/ distance value of, say 4.75, then you must multiple the values from the fomula by 4.75. In that way, the frame preceeding/folowing the linear move can only be less.
If you know the distance (37.5 cm) for a move ( with 6 frames ease-in. linear component of 12 and an ease-out of

Assume the linear move is 1.00. Add up the accummulative values of the ease-in and ease out fairings, then add that to the linear move total (1.0 * 12 frames) You should have something like 5.3 + 12 + 7.7 units (not cm or frames). Your total is 25 distance units of unknown scale.
All you have to do now is divide 30cm but 20 and you have a linear move of 1.5 cm. Multiply all the fairing values by this and you'll have a pan bang on length, with smooth accelerations and decellerations, and no speed jumps at the takeover point.
Okay here is the code.
Code: Select all
# -------------------------------------------------
# Radian based Fairings
# Version: 1.02, Date: 2006-01-26
# (c)2006 T.J Francis
# tim.francis@hotmail.com
# --------------------------------------------------
# Open Licence - this formula may be reproduced and
# incorported in to any application as you wish.
#
# The only conditions for use and re-use are:
# *Credit must be is given to the formula's
# author, i.e., me.
# *If distributed, it must be done for free.
#---------------------------------------------------
#--- Preamble --------------------------------------
# This calculation is based on the maxim that the
# maximum velocity can only be 1 (ie, 100%).
#---------------------------------------------------
# --- variables / initialize variables -------------
Fairing_frames = 8
velocity_unit = 0.0
degree_unit = 90/(Fairing_frames + 1)
frame_degree = 0.0
frame = 0
# -------------------------------------------------------------------
# velocity unit = math.cos(math.radians(90/(Fairing_frames + 1)))
# -------------------------------------------------------------------
print ""
print "-------------------------"
print " Radian based Fairings"
print "-------------------------"
import math
for frame in range(Fairing_frames+1):
velocity_unit = 1 - math.cos(math.radians(frame_degree))
print " fr:", '%3.0d' % frame, " Vel: ", '%6.3f' % velocity_unit
if frame == 0: print ""
frame_degree = frame_degree + degree_unit
print ""
velocity_unit = 1 - math.cos(math.radians(frame_degree))
print " fr:", '%3.0d' % (frame + 1), " Vel: ", '%6.3f' % velocity_unit
print "-------------------------"
Any problem, ask.
I'll do the graphics tomorrow.
Regards
Rhoel