Another project
0

Configure Feed

Select the types of activity you want to include in your feed.

1use bone_types::{Length, Parameter, Point2, Point3}; 2 3#[derive(Copy, Clone, Debug, PartialEq)] 4pub struct ClosestPoint<P> { 5 parameter: Parameter, 6 point: P, 7 distance: Length, 8} 9 10pub type ClosestPoint2 = ClosestPoint<Point2>; 11pub type ClosestPoint3 = ClosestPoint<Point3>; 12 13impl<P: Copy> ClosestPoint<P> { 14 #[must_use] 15 pub const fn new(parameter: Parameter, point: P, distance: Length) -> Self { 16 Self { 17 parameter, 18 point, 19 distance, 20 } 21 } 22 23 #[must_use] 24 pub const fn parameter(self) -> Parameter { 25 self.parameter 26 } 27 28 #[must_use] 29 pub const fn point(self) -> P { 30 self.point 31 } 32 33 #[must_use] 34 pub const fn distance(self) -> Length { 35 self.distance 36 } 37} 38 39impl<P: core::fmt::Display> core::fmt::Display for ClosestPoint<P> { 40 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 41 use uom::si::length::millimeter; 42 write!( 43 f, 44 "closest{{ t={}, p={}, d={} mm }}", 45 self.parameter.value(), 46 self.point, 47 self.distance.get::<millimeter>(), 48 ) 49 } 50}