rect: fix dist_squared calculation
This commit is contained in:
parent
086f3eb4f8
commit
09145480e1
1 changed files with 2 additions and 2 deletions
|
|
@ -128,13 +128,13 @@ impl Rect {
|
|||
if self.raw.x1 > x {
|
||||
dx = self.raw.x1 - x;
|
||||
} else if self.raw.x2 < x {
|
||||
dx = x - self.raw.x1;
|
||||
dx = x - self.raw.x2;
|
||||
}
|
||||
let mut dy = 0;
|
||||
if self.raw.y1 > y {
|
||||
dy = self.raw.y1 - y;
|
||||
} else if self.raw.y2 < y {
|
||||
dy = y - self.raw.y1;
|
||||
dy = y - self.raw.y2;
|
||||
}
|
||||
dx * dx + dy * dy
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue