Friday, June 05, 2009
Scaling PITCHf/x
Someone asked me how I scale a pitch from PITCHf/x to a common scale. This is my response:
sz_top (operator-marked top of strike zone)
sz_bottom (operator-marked bottom of strike zone)
pz (location of pitch)
new_top (whatever constant you want to set for all players)
new_bottom (ditto)
How to scale a pitch
IF pz > sz_top
pz
- sz_top
+ new_top
# we want to keep the relative position, with no stretching
IF pz < sz_bottom
(pz - 0)
/ (sz_bottom - 0)
* (new_bottom - 0)
+ 0
# we want to stretch the position based on the bottom of the zone and the ground
# I realize the 0 is extraneous, but I wanted to show it so you can see the form and how it matches the next step
ELSE
(pz-sz_bottom)
/ (sz_top-sz_bottom)
* (new_top-new_bottom)
+ new_bottom
# we want to stretch the position within the zone itself being the universe, and then moving the whole zone up or down