geometry: style++
This commit is contained in:
parent
60bcf4faa3
commit
e8f6a90d0f
@ -32,13 +32,13 @@ pub trait CoordLimits: PartialOrd + PartialEq + Sub + Clone + Mul + Copy + One +
|
|||||||
|
|
||||||
impl CoordLimits for u8 {
|
impl CoordLimits for u8 {
|
||||||
type Data = u8;
|
type Data = u8;
|
||||||
|
const MIN: u8 = 0;
|
||||||
|
const MAX: u8 = 255;
|
||||||
|
|
||||||
fn distance(x1: Self, y1: Self, x2: Self, y2: Self) -> Self {
|
fn distance(x1: Self, y1: Self, x2: Self, y2: Self) -> Self {
|
||||||
(max(x2, x1) - min(x2, x1)).saturating_add(max(y2, y1) - min(y2, y1))
|
(max(x2, x1) - min(x2, x1)).saturating_add(max(y2, y1) - min(y2, y1))
|
||||||
//(pow(x2 as u16 - x1 as u16, 2) + pow(y2 as u16 - y1 as u16, 2)).sqrt() as u8
|
//(pow(x2 as u16 - x1 as u16, 2) + pow(y2 as u16 - y1 as u16, 2)).sqrt() as u8
|
||||||
}
|
}
|
||||||
const MIN: u8 = 0;
|
|
||||||
const MAX: u8 = 255;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CoordLimits for u16 {
|
impl CoordLimits for u16 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user