rust/integral-geometry/src/lib.rs
branchtransitional_engine
changeset 16051 2003b466b279
parent 15948 9bd828451d77
parent 16010 5ba4d3a0c3eb
child 16056 d4675c190fa5
equal deleted inserted replaced
16050:6a3dc15b78b9 16051:2003b466b279
    57         )
    57         )
    58     }
    58     }
    59 
    59 
    60     #[inline]
    60     #[inline]
    61     pub const fn rotate90(self) -> Self {
    61     pub const fn rotate90(self) -> Self {
    62         Point::new(self.y, -self.x)
    62         Self::new(self.y, -self.x)
    63     }
    63     }
    64 
    64 
    65     #[inline]
    65     #[inline]
    66     pub const fn cross(self, other: Point) -> i32 {
    66     pub const fn cross(self, other: Point) -> i32 {
    67         self.dot(other.rotate90())
    67         self.dot(other.rotate90())
    68     }
    68     }
    69 
    69 
    70     #[inline]
    70     #[inline]
    71     pub fn clamp(self, rect: &Rect) -> Point {
    71     pub fn clamp(self, rect: &Rect) -> Self {
    72         Point::new(rect.x_range().clamp(self.x), rect.y_range().clamp(self.y))
    72         Self::new(rect.x_range().clamp(self.x), rect.y_range().clamp(self.y))
    73     }
    73     }
    74 
    74 
    75     #[inline]
    75     #[inline]
    76     pub const fn line_to(self, end: Point) -> Line {
    76     pub const fn line_to(self, end: Point) -> Line {
    77         Line::new(self, end)
    77         Line::new(self, end)