pub fn cost_v2<T: MyFloat>(
initial: PhysicsStateV3<T>,
curve: &Spline<T>,
step: Fpt,
) -> Option<Fpt>Expand description
Given initial state and curve, calculates the total cost of the curve
This requires a physics simulation be run, with the paramer initial being
the starting physical state of the object, including properties like
position, velocity, and other parameters.
Return a valid cost as a Option<Fpt>, or return None if the cost
can’t be computed
- happens when the coaster gets stuck
§Implementation Details
let mut phys = initial; copies the initial physical state into a mutable
variable phys, which evolves as the simulation progresses
phys.cost() computes the total cost of the curve, if cost is Nan, it
returns None to indicate an invalid calculation