Resize on border (#1347)

This commit is contained in:
Ching Pei Yang
2023-02-18 23:35:31 +01:00
committed by GitHub
parent b944386ca5
commit c92e0c05e4
11 changed files with 228 additions and 51 deletions

View File

@@ -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);
}