use std::io; use std::io::Read; use fts_units::quantity::*; use fts_units::si_system::quantities::f32::*; use fts_units::si_system::*; use typenum::consts::*; fn main() { let m = Meters::new(10.7); println!("Meters: {}", m); let km = Kilometers::new(35.7); println!("Kilometers: {}", km); let mps = MetersPerSecond::new(22.5); println!("MetersPerSecond: {}", mps); let dist = Centimeters::new(2.3); let mass = Kilograms::new(5.4); let time: QuantityT, SIExponentsT>> = Seconds::new(4.1); let time_sq: QuantityT, SIExponentsT>> = time * time; let inv_time_sq1 = Dimensionless::new(1.0) / time_sq; let inv_time_sq2 = Dimensionless::new(1.0) / (time * time); let inv_time_sq3 = Dimensionless::new(1.0) / time / time; assert_eq!(inv_time_sq1, inv_time_sq2); assert_eq!(inv_time_sq1, inv_time_sq3); assert_eq!(inv_time_sq2, inv_time_sq3); let inv_time: QuantityT, SIExponentsT>> = Dimensionless::new(1.0) / time; let _accel: QuantityT, SIExponentsT>> = dist * inv_time * inv_time; let accel: QuantityT, SIExponentsT>> = dist / (time * time); let force = mass * accel; println!("Force: {}", force); let force: QuantityT, _>> = force.convert_into(); println!("Force: {}", force); /* type Ray = fts_intersect3::shapes::Ray; type Segment = fts_intersect3::shapes::Segment; type Vec3 = fts_vecmath::vector3::Vector3; macro_rules! assert_abs_eq { ($left: expr, $right:expr, $abs: expr, $line: expr) => { assert!(abs_eq($left, $right, $abs), "\nLeft: [{:?}] \nRight: [{:?}] \nDiff:[{:?}] \nThresh: [{}] \nLine: [{}]\n", $left, $right, ($right - $left), $abs, $line); }; } let x = Vec3::x_axis(); let x_dir = x.as_unit(); let zero = Vec3::zero(); let epsilon = 1e-6; let test = |ray, seg, dist_sq, c_ray, c_seg, t_ray, t_seg, line| { let result = closest_ray_segment(ray, seg); assert_abs_eq!(result.distance_sq, dist_sq, epsilon, line); assert_abs_eq!(result.closest_ray, c_ray, epsilon, line); assert_abs_eq!(result.closest_seg, c_seg, epsilon, line); assert_abs_eq!(result.time_ray, t_ray, epsilon, line); assert_abs_eq!(result.time_seg, t_seg, epsilon, line); }; test(Ray::new(zero, x_dir), Segment::new(x, 2.0*x), 0.0, x, x, 1.0, 0.0, line!()); */ // ------------------------------------------------------------ // Do not modify below this line // ------------------------------------------------------------ println!("Hit enter to continue"); let mut input = [0; 1]; let _ = io::stdin().read_exact(&mut input); }