rust/integral-geometry/src/lib.rs
changeset 14149 165e43c3ed59
parent 14147 11202097584f
child 14151 4791c9a7d5e8
equal deleted inserted replaced
14148:745c73e0e644 14149:165e43c3ed59
    96     pub fn cotangent_mul(self, y: i32) -> i32 {
    96     pub fn cotangent_mul(self, y: i32) -> i32 {
    97         y * self.x / self.y
    97         y * self.x / self.y
    98     }
    98     }
    99 
    99 
   100     #[inline]
   100     #[inline]
   101     pub fn to_fppoint(&self) -> FPPoint {
   101     pub fn to_fppoint(self) -> FPPoint {
   102         FPPoint::new(self.x.into(), self.y.into())
   102         FPPoint::new(self.x.into(), self.y.into())
       
   103     }
       
   104 
       
   105     #[inline]
       
   106     pub fn from_fppoint(p: &FPPoint) -> Self {
       
   107         Self::new(p.x().round(), p.y().round())
   103     }
   108     }
   104 }
   109 }
   105 
   110 
   106 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
   111 #[derive(PartialEq, Eq, Clone, Copy, Debug)]
   107 pub struct Size {
   112 pub struct Size {