Polygon: Remove API to set manually extent

The extent has to be calculated from the vertices and shouldn't be modified manually.
This commit is contained in:
Peter Keresztes Schmidt 2021-05-14 20:08:25 +02:00
parent ef7a083891
commit dc79ec52c2
2 changed files with 1 additions and 12 deletions

View File

@ -35,11 +35,7 @@ class Box {
Box(Vector2 lo, Vector2 hi) : lo_(lo), hi_(hi), size_(Vector2::Range(hi, lo)) {} Box(Vector2 lo, Vector2 hi) : lo_(lo), hi_(hi), size_(Vector2::Range(hi, lo)) {}
const Vector2 &Lo() const { return lo_; } const Vector2 &Lo() const { return lo_; }
int32 LoX(int lo_x) { return lo_.x_ = lo_x; }
int32 LoY(int lo_y) { return lo_.y_ = lo_y; }
const Vector2 &Hi() const { return hi_; } const Vector2 &Hi() const { return hi_; }
int32 HiX(int hi_x) { return hi_.x_ = hi_x; }
int32 HiY(int hi_y) { return hi_.y_ = hi_y; }
const Vector2 &Size() const { return size_; } const Vector2 &Size() const { return size_; }
int32 Area() const { return size_.x_ * size_.y_; } int32 Area() const { return size_.x_ * size_.y_; }

View File

@ -50,15 +50,8 @@ class Polygon {
} }
const Box &Extent() const { return extent; } const Box &Extent() const { return extent; }
int32 LoX(int p_lo_x) { return extent.LoX(p_lo_x); }
int32 HiX(int p_hi_x) { return extent.HiX(p_hi_x); }
int32 LoY(int p_lo_y) { return extent.LoY(p_lo_y); }
int32 HiY(int p_hi_y) { return extent.HiY(p_hi_y); }
int32 Area() const { return area; } int32 Area() const { return area; }
const Vector2 &Centre() const { const Vector2 &Centre() const { return centre; }
return centre;
}
bool Contains(const Vector2 &coord) const; bool Contains(const Vector2 &coord) const;