77 double back_length,
double width);
100 const Vec2d &opposite_corner);
124 double length()
const {
return length_; }
130 double width()
const {
return width_; }
166 double area()
const {
return length_ * width_; }
172 double diagonal()
const {
return std::hypot(length_, width_); }
269 double max_x()
const {
return max_x_; }
270 double min_x()
const {
return min_x_; }
271 double max_y()
const {
return max_y_; }
272 double min_y()
const {
return min_y_; }
275 inline bool is_inside_rectangle(
const Vec2d &point)
const {
276 return (point.
x() >= 0.0 && point.
x() <= width_ && point.
y() >= 0.0 &&
277 point.
y() <= length_);
281 double length_ = 0.0;
283 double half_length_ = 0.0;
284 double half_width_ = 0.0;
285 double heading_ = 0.0;
286 double cos_heading_ = 1.0;
287 double sin_heading_ = 0.0;
289 std::vector<Vec2d> corners_;
291 double max_x_ = std::numeric_limits<double>::lowest();
292 double min_x_ = std::numeric_limits<double>::max();
293 double max_y_ = std::numeric_limits<double>::lowest();
294 double min_y_ = std::numeric_limits<double>::max();
Defines the AABox2d class.
Implements a class of (undirected) axes-aligned bounding boxes in 2-D.
Rectangular (undirected) bounding box in 2-D.
std::string DebugString() const
Gets a human-readable description of the box
void Shift(const Vec2d &shift_vec)
Shifts this box by a given vector
double diagonal() const
Getter of the size of the diagonal of the box
bool IsPointOnBoundary(const Vec2d &point) const
Tests points for membership in the boundary of the box
double half_width() const
Getter of half the width
void LateralExtend(const double extension_length)
bool HasOverlap(const LineSegment2d &line_segment) const
Determines whether this box overlaps a given line segment
AABox2d GetAABox() const
Gets the smallest axes-aligned box containing the current one
double center_x() const
Getter of the x-coordinate of the center of the box
void RotateFromCenter(const double rotate_angle)
Rotate from center.
double width() const
Getter of the width
const Vec2d & center() const
Getter of the center of the box
double length() const
Getter of the length
bool IsPointIn(const Vec2d &point) const
Tests points for membership in the box
double half_length() const
Getter of half the length
double heading() const
Getter of the heading
double sin_heading() const
Getter of the sine of the heading
double DistanceTo(const Vec2d &point) const
Determines the distance between the box and a given point
double area() const
Getter of the area of the box
double cos_heading() const
Getter of the cosine of the heading
const std::vector< Vec2d > & GetAllCorners() const
Getter of the corners of the box
static Box2d CreateAABox(const Vec2d &one_corner, const Vec2d &opposite_corner)
Creates an axes-aligned Box2d from two opposite corners
void LongitudinalExtend(const double extension_length)
Extend the box longitudinally
double center_y() const
Getter of the y-coordinate of the center of the box
Implements a class of 2-dimensional vectors.
double y() const
Getter for y component
double x() const
Getter for x component
Define the LineSegment2d class.