87 const Vec2d &opposite_corner);
111 double length()
const {
return length_; }
117 double width()
const {
return width_; }
153 double area()
const {
return length_ * width_; }
159 double diagonal()
const {
return std::hypot(length_, width_); }
256 double max_x()
const {
return max_x_; }
257 double min_x()
const {
return min_x_; }
258 double max_y()
const {
return max_y_; }
259 double min_y()
const {
return min_y_; }
263 double length_ = 0.0;
265 double half_length_ = 0.0;
266 double half_width_ = 0.0;
267 double heading_ = 0.0;
268 double cos_heading_ = 1.0;
269 double sin_heading_ = 0.0;
271 std::vector<Vec2d> corners_;
273 double max_x_ = std::numeric_limits<double>::lowest();
274 double min_x_ = std::numeric_limits<double>::max();
275 double max_y_ = std::numeric_limits<double>::lowest();
276 double min_y_ = std::numeric_limits<double>::max();
double x() const
Getter for x component.
Definition: vec2d.h:54
double y() const
Getter for y component.
Definition: vec2d.h:57
const Vec2d & center() const
Getter of the center of the box.
Definition: box2d.h:93
Define the LineSegment2d class.
double center_y() const
Getter of the y-coordinate of the center of the box.
Definition: box2d.h:105
void Shift(const Vec2d &shift_vec)
Shifts this box by a given vector.
void LateralExtend(const double extension_length)
double center_x() const
Getter of the x-coordinate of the center of the box.
Definition: box2d.h:99
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
double max_x() const
Definition: box2d.h:256
double DistanceTo(const Vec2d &point) const
Determines the distance between the box and a given point.
std::string DebugString() const
Gets a human-readable description of the box.
double length() const
Getter of the length.
Definition: box2d.h:111
bool IsPointIn(const Vec2d &point) const
Tests points for membership in the box.
std::vector< Vec2d > GetAllCorners() const
Getter of the corners of the box.
double cos_heading() const
Getter of the cosine of the heading.
Definition: box2d.h:141
Rectangular (undirected) bounding box in 2-D.
Definition: box2d.h:52
double diagonal() const
Getter of the size of the diagonal of the box.
Definition: box2d.h:159
bool IsPointOnBoundary(const Vec2d &point) const
Tests points for membership in the boundary of the box.
Line segment in 2-D.
Definition: line_segment2d.h:40
Defines the AABox2d class.
Implements a class of 2-dimensional vectors.
Definition: vec2d.h:42
double heading() const
Getter of the heading.
Definition: box2d.h:135
AABox2d GetAABox() const
Gets the smallest axes-aligned box containing the current one.
double max_y() const
Definition: box2d.h:258
double width() const
Getter of the width.
Definition: box2d.h:117
void RotateFromCenter(const double rotate_angle)
Rotate from center.
double min_x() const
Definition: box2d.h:257
double min_y() const
Definition: box2d.h:259
double sin_heading() const
Getter of the sine of the heading.
Definition: box2d.h:147
void LongitudinalExtend(const double extension_length)
Extend the box longitudinally.
double half_length() const
Getter of half the length.
Definition: box2d.h:123
double half_width() const
Getter of half the width.
Definition: box2d.h:129
static Box2d CreateAABox(const Vec2d &one_corner, const Vec2d &opposite_corner)
Creates an axes-aligned Box2d from two opposite corners.
bool HasOverlap(const LineSegment2d &line_segment) const
Determines whether this box overlaps a given line segment.
double area() const
Getter of the area of the box.
Definition: box2d.h:153
Implements a class of (undirected) axes-aligned bounding boxes in 2-D. This class is referential-agno...
Definition: aabox2d.h:42