Skip to main content

ForceModel

Trait ForceModel 

Source
pub trait ForceModel {
    // Required method
    fn acceleration(&self, state: &FlightState, mass_kg: f64) -> Result<Vec3>;

    // Provided method
    fn acceleration_with_axis(
        &self,
        state: &FlightState,
        mass_kg: f64,
        _body_axis: Vec3,
    ) -> Result<Vec3> { ... }
}
Expand description

Environmental acceleration hook (gravity, drag, wind, etc.), without motor or controls.

Called at every RK4 stage with the stage’s position, velocity, time and current mass. Implementations must be deterministic and side-effect free for reproducible integration.

Required Methods§

Source

fn acceleration(&self, state: &FlightState, mass_kg: f64) -> Result<Vec3>

Acceleration in world-frame metres per second squared.

Provided Methods§

Source

fn acceleration_with_axis( &self, state: &FlightState, mass_kg: f64, _body_axis: Vec3, ) -> Result<Vec3>

Acceleration when the commanded body axis is known, for angle-of-attack-aware models (body lift, induced drag). body_axis is the solver-resolved unit thrust axis at this stage. The default ignores the axis, which keeps every orientation-blind model (gravity, plain drag) bit-identical.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§