Skip to main content

convert_length

Function convert_length 

Source
pub fn convert_length(value: f64, from: LengthUnit, to: LengthUnit) -> f64
Expand description

Convert a length value from from units to to units.

ยงExamples

use oxiphysics_core::unit_conversion::{LengthUnit, convert_length};
let inches = convert_length(1.0, LengthUnit::Foot, LengthUnit::Inch);
assert!((inches - 12.0).abs() < 1e-10);