69 explicit AABox2d(
const std::vector<Vec2d> &points);
93 double length()
const {
return length_; }
99 double width()
const {
return width_; }
117 double area()
const {
return length_ * width_; }
124 double min_x()
const {
return center_.
x() - half_length_; }
131 double max_x()
const {
return center_.
x() + half_length_; }
138 double min_y()
const {
return center_.
y() - half_width_; }
145 double max_y()
const {
return center_.
y() + half_width_; }
220 double length_ = 0.0;
222 double half_length_ = 0.0;
223 double half_width_ = 0.0;
Implements a class of (undirected) axes-aligned bounding boxes in 2-D.
double max_y() const
Returns the maximum y-coordinate of the box
double min_x() const
Returns the minimum x-coordinate of the box
double min_y() const
Returns the minimum y-coordinate of the box
const Vec2d & center() const
Getter of center_
void MergeFrom(const AABox2d &other_box)
Changes box to include another given box, as well as the current one.
double length() const
Getter of length_
double center_y() const
Getter of y-component of center_
double half_length() const
Getter of half_length_
std::string DebugString() const
Gets a human-readable debug string
bool IsPointOnBoundary(const Vec2d &point) const
Determines whether a given point is on the boundary of the box.
bool HasOverlap(const AABox2d &box) const
Determines whether two boxes overlap.
double width() const
Getter of width_
double half_width() const
Getter of half_width_
double center_x() const
Getter of x-component of center_
void Shift(const Vec2d &shift_vec)
Shift the center of AABox by the input vector.
bool IsPointIn(const Vec2d &point) const
Determines whether a given point is in the box.
double DistanceTo(const Vec2d &point) const
Determines the distance between a point and the box.
AABox2d()=default
Default constructor.
double max_x() const
Returns the maximum x-coordinate of the box
double area() const
Getter of length_*width_
void GetAllCorners(std::vector< Vec2d > *const corners) const
Gets all corners in counter clockwise order.
Implements a class of 2-dimensional vectors.
double y() const
Getter for y component
double x() const
Getter for x component