// geom.rs Simple geometry stuff.
//// Copyright (c) 2017-2021 Douglas P Lau
//usepointy::Pt;/// 2-dimensional vector / point with associated width.
#[derive(Clone, Copy, Debug, PartialEq)]pubstructWidePt(pub Pt<f32>, pub f32);/// Calculate linear interpolation of two values
////// The t value should be between 0 and 1.
pubfnfloat_lerp(a:f32, b:f32, t:f32)->f32{
b +(a - b)* t
}implDefault forWidePt{fndefault()->Self{
WidePt(Pt::default(),1.0)}}implWidePt{/// Get the width
pubfnw(self)->f32{self.1}/// Find the midpoint between two wide points
pubfnmidpoint(self, rhs:Self)->Self{let v =self.0.midpoint(rhs.0);let w =(self.w()+ rhs.w())/2.0;
WidePt(v, w)}}