Skip to main content

CompassModel

Trait CompassModel 

Source
pub trait CompassModel {
    // Required method
    fn deviation(
        &self,
        course: Direction<Compass>,
    ) -> Result<Deviation, KernelError>;
}
Expand description

Ship’s magnetism as compass deviation.

Swung table, Smith coefficients or calibrated fluxgate. Deviation is a function of the compass course (what is read on the card), not the magnetic course; the inverse is a solve performed by the algorithms.

Required Methods§

Source

fn deviation( &self, course: Direction<Compass>, ) -> Result<Deviation, KernelError>

Deviation on course.

§Errors

Any error the model raises: table too sparse, course not covered.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl CompassModel for DeviationTable

Table read with the default InterpolationMethod::Linear.

Linear is exact at nodes and never overshoots, the safe default. For a smoother curve, or to prepare a spline once instead of per call, use DeviationTable::interpolated.

Source§

impl CompassModel for InterpolatedTable<'_>

Source§

impl CompassModel for SmithCoefficients

Five-coefficient model as a CompassModel.

SmithCoefficients::deviation_at returns a plain f64 because a fit can produce absurd values; here a Deviation is required, so such values yield KernelError::OutOfRange.