Skip to main content

Crate opengolfcoach

Crate opengolfcoach 

Source

Re-exports§

pub use bindings::calculate_derived_values;
pub use bindings::calculate_derived_values_ffi;

Modules§

bindings

Structs§

ClubFacePathEstimates
Estimated face/path relationship for a given shot
DerivedValues
Derived values calculated by OpenGolfCoach
Handed
Wrapper carrying both right-handed and left-handed perspectives of a value.
InputData
Input data structure for reading values from JSON.
InputUSCustomaryUnits
Trajectory
Ball trajectory data - sequence of trajectory points
TrajectoryOutput
Sampled ball trajectory. Emitted under open_golf_coach.trajectory when the caller opts in via trajectory_enabled. The internal simulation runs at 500 Hz; sample_rate_hz is the (effective, post-clamp) rate at which the points were emitted, and the points are linearly interpolated between native integrator steps. Coordinates: +X forward, +Y right, +Z up (left-handed; matches Unreal natively, swizzle for Unity / Three.js).
TrajectoryPoint
A single point in the golf ball trajectory
USCustomaryValues
Vector3
3D Vector for position and velocity

Constants§

NATIVE_RATE_HZ
Physics constants and ball properties Native simulation rate of the trajectory integrator. Down-sampling and Unity/Unreal/Three.js callers reference this same constant so the rate cannot drift out of sync between modules.

Functions§

calculate_derived_values_from_input
Calculate all derived values from input data
calculate_spin_components
Convert total spin and spin axis to backspin and sidespin components
calculate_total_spin_and_axis
Convert backspin and sidespin to total spin and spin axis
calculate_trajectory
Calculate full ball trajectory using numerical integration
down_sample_trajectory
Down-sample a native-rate Trajectory to target_hz by linearly interpolating each emitted point between the bracketing native steps.
estimate_club_face_path
Estimate club path/face parameters using simplified D-plane assumptions.
estimate_clubhead_speed
Estimate clubhead speed from ball launch conditions
get_apex_position
Get apex (highest point) from trajectory Returns the position of the highest point in the trajectory
get_carry_distance
Get carry distance from trajectory Returns the total distance traveled (magnitude of landing position)
get_descent_angle
Get descent angle from trajectory Returns the angle between landing velocity and horizontal plane in degrees
get_hang_time
Get hang time from trajectory Returns the total flight time in seconds
get_landing_position
Get landing position from trajectory Returns the final position in the trajectory (where ball lands)
get_landing_velocity
Get landing velocity from trajectory Returns the final velocity in the trajectory (velocity at landing)
get_offline_distance
Get offline distance from trajectory Returns the lateral (Y-axis) distance from centerline
get_peak_height
Get peak height from trajectory Returns the maximum height (Z coordinate) reached during flight
get_smash_factor
Calculate smash factor (ball speed / clubhead speed ratio)
get_time_to_apex
Get time to apex from trajectory Returns the time at which the ball reaches its highest point
get_total_distance
Estimate run-out after landing and return total distance (carry + roll)