Function: statcastPitchPath()
statcastPitchPath(
pitch,o?): [number,number,number][]
Defined in: packages/sdvplot/src/three/statcast.ts:77
A pitch's flight from release to the front of home plate, as [x, y, z] points in feet in Statcast's frame, which
is sporty's baseball frame too (home plate's point at the origin, y towards the mound), so the path draws over
surfaceMesh("baseball", "mlb") unconverted. Statcast describes each pitch with the PITCHf/x nine-parameter fit:
constant acceleration (ax, ay, az) and the velocity (vx0, vy0, vz0) at y = 50 ft, so
p(t) = p50 + v0 t + a t² / 2 (Baseball Savant CSV documentation, https://baseballsavant.mlb.com/csv-docs: "vx0,
vy0, vz0: the velocity of the pitch, in feet per second, in x, y, and z dimensions, determined at y=50 feet"; "ax,
ay, az: the acceleration of the pitch, in feet per second per second ... determined at y=50 feet"; A. M. Nathan,
"Determining Pitch Movement from PITCHf/x Data", 2012, https://baseball.physics.illinois.edu/Movement.pdf). Savant's
CSV leaves out x and z at y = 50, so they are solved from where the fit crosses the plate (plate_x, plate_z: at its
front edge, y = 17/12 ft, through 2025; at its middle, y = 8.5/12 ft, from 2026, per the same documentation); the
path then runs, equal steps in time, from y = release_pos_y to that plane. The 2026 middle-of-plate rule is from
Savant's documentation of its MLB search: for its World Baseball Classic or minor-league searches, pass plate
explicitly rather than rely on game_year. Each field must be a number: filter out rows with an empty CSV cell
first, since Number("") is 0 and would pass as a real value. Traced back to the release, it lands on
Savant's own release_pos_x / release_pos_z within their 0.01 ft rounding (checked on 2024 and 2026 pitches).
Parameters
pitch
o?
StatcastPathOptions = {}
Returns
[number, number, number][]
Example
import { statcastPitchPath } from "@sportsdataverse/sdvplot/three";
// a 96.3 mph four-seamer, Yankees at Red Sox, 2024-06-15 (Baseball Savant: game 746946, at-bat 48, pitch 4)
const pitch = {
vx0: -6.245145230392043, vy0: -140.0548111003631, vz0: -4.647911601289857,
ax: 12.681580763686934, ay: 32.15363682007945, az: -12.428443024407864,
plate_x: 0.42927397039380755, plate_z: 3.546869816011372, release_pos_y: 54.12, game_year: 2024,
};
const path = statcastPitchPath(pitch); // 41 points, release to plate
path[0]; // about [2.05, 54.12, 6.17]: Savant's release_pos_x, release_pos_y, release_pos_z