Resize on border (#1347)
This commit is contained in:
parent
b944386ca5
commit
c92e0c05e4
11 changed files with 228 additions and 51 deletions
|
|
@ -29,4 +29,10 @@ Vector2D Vector2D::floor() {
|
|||
|
||||
Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) {
|
||||
return Vector2D(std::clamp(this->x, min.x, max.x == 0 ? INFINITY : max.x), std::clamp(this->y, min.y, max.y == 0 ? INFINITY : max.y));
|
||||
}
|
||||
}
|
||||
|
||||
double Vector2D::distance(const Vector2D& other) {
|
||||
double dx = x - other.x;
|
||||
double dy = y - other.y;
|
||||
return std::sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue