All MicroEvals
Build a complete, interactive 3D baseball aerodynamics simul...
Create MicroEval

Build a complete, interactive 3D baseball aerodynamics simul...

Prompt

Build a complete, interactive 3D baseball aerodynamics simulator as a single HTML document containing its CSS and JavaScript. Return only the runnable HTML, without Markdown fences. Use Three.js through a pinned CDN version if needed; require no build tools, backend, API keys, or external image/model assets. Implement the application fully in this response. OBJECTIVE Simulate a Rawlings ROMLB-style official MLB baseball in flight. Let users explore how pitch speed, spin rate, spin-axis direction, release angle, and initial seam orientation affect trajectory, aerodynamic movement, and the surrounding airflow. Prioritize, in order: working functionality, physically defensible calculations, baseball geometry, clear visualization, and visual polish. BASEBALL GEOMETRY • Procedurally construct a realistic white leather baseball with two interlocking panels, a continuous baseball seam, and individually visible red stitches. Do not substitute intersecting circles for the seam. • Represent low-profile “flat” seams, with adjustable seam height and stitch spacing. • Construct the opposing horseshoe seam regions with a target minimum separation of 20 mm at two diametrically opposing locations. For this implementation, measure the shortest surface distance between the facing seam centerlines within each horseshoe’s narrow region. Mark both measurements in an optional geometry-inspection view. • Treat 20 mm as a user-specified design constraint, not a verified ROMLB manufacturing specification. • Use plausible nominal dimensions and mass, explicitly labeled as assumptions wherever reliable ROMLB measurements are unavailable. Expose diameter, mass, and seam height in an advanced panel. Never invent manufacturer verification. • Keep the physical ball at its correct scale in the trajectory calculation. Provide a separate magnified inspection view so seams remain visible. INTERACTIVE CONTROLS Provide labeled sliders and numeric inputs for: • Release speed: 40–105 mph. • Spin rate: 0–4,000 RPM. • Spin-axis azimuth and elevation. • Vertical and horizontal release angles. • Release height and release-to-target distance. • Initial seam orientation, independently of the spin axis. • Wind speed and direction. Include presets for backspin, topspin, sidespin, pure gyrospin, and mixed spin. Include play/pause, restart, slow motion, a timeline scrubber, and camera orbit/zoom. Every control must work. COORDINATES AND PHYSICS Define a right-handed coordinate system: +X toward the target, +Y to the pitcher’s left, and +Z upward. Use SI units internally. Integrate motion using a stable fixed simulation time step independent of rendering frame rate. Model gravity, aerodynamic drag, and Magnus lift using air-relative velocity. Document the equations and coefficient assumptions in a collapsible “Physics and limitations” panel. Calculate spin-induced lift from the transverse component of angular velocity; pure gyrospin must produce zero Magnus lift in this model. Handle zero speed and zero spin without numerical errors. Update ball orientation consistently with its angular-velocity vector. Do not claim that seam orientation changes aerodynamic forces unless a corresponding model is actually implemented and its assumptions are disclosed. TRAJECTORY COMPARISON Show three color-coded trajectories starting from identical release conditions: 1. Gravity + drag + modeled aerodynamic lift. 2. Gravity only, without air resistance. 3. Gravity + drag, with lift disabled. At the target plane, report: • Horizontal and vertical displacement relative to each baseline. • Magnitude of the transverse displacement. • Flight time and arrival speed for each trajectory. • Direction of aerodynamic movement. Use each trajectory’s own target-plane crossing time, interpolated between integration steps. Also provide an equal-elapsed-time comparison mode; clearly distinguish it from target-plane comparisons. If a trajectory hits the ground first, report that it did not reach the target. AIRFLOW AND WAKE VISUALIZATION Provide a synchronized ball-centered view showing relative airflow, the downstream wake, and vortex structures or vortex-shedding illustrations. Allow toggling particles, wake trails, spin-axis arrows, velocity arrows, and force vectors. Keep airflow behavior consistent with air-relative velocity and spin direction. Distinguish particle pathlines from instantaneous streamlines. A browser-feasible reduced-order aerodynamic model is acceptable. However, any wake or vortex visualization not computed by a fluid solver must be visibly labeled “Illustrative airflow — not resolved CFD.” Do not fabricate quantitative pressure fields, turbulence predictions, or seam-shifted-wake accuracy. INTERFACE Create a polished scientific dashboard with: • A large 3D trajectory viewport. • A magnified rotating baseball/airflow viewport. • Organized controls and a clear trajectory legend. • Live numerical movement readouts with units. • Optional geometry measurements and physics details. • Responsive layout, readable labels, and accessible contrast. Keep ball magnification, arrow scaling, and slow-motion playback clearly labeled. These display settings must not change the physics. BUILT-IN VERIFICATION Include a compact verification panel that executes and reports: • Gravity-only numerical motion versus the analytical solution. • Zero Magnus lift at zero spin. • Zero Magnus lift for spin parallel to air-relative velocity. • Reversed initial Magnus-force direction when transverse spin reverses. • Target-plane displacement sensitivity when the integration time step is halved. • The achieved seam separation at both specified horseshoe locations. Report measured errors or residuals, not hard-coded “PASS” labels. Do not describe internal consistency checks as experimental validation. DELIVERY Return the complete runnable implementation. Include no placeholders, TODOs, inert controls, or promises of future implementation. If a requested capability is approximated, disclose that clearly inside the application while implementing the strongest feasible version.

A system prompt was added to support web rendering

Drag to resize

Response not available

Drag to resize
Drag to resize
Drag to resize
Drag to resize