83 double left()
const {
return x; }
129 std::vector<Point>
corners()
const;
2D point with high-precision coordinates and utility methods
Polygon class supporting both convex and concave polygons.
Axis-aligned rectangle for bounding boxes and simple EDA components.
double top() const
Get top edge Y coordinate.
Point bottom_left() const
Get bottom-left corner point.
double left() const
Get left edge X coordinate.
bool is_valid() const
Check if rectangle is valid (positive dimensions)
double area() const
Calculate rectangle area.
double y
Y coordinate of bottom-left corner.
std::string to_string() const
Get string representation.
Polygon to_polygon() const
Convert rectangle to polygon representation.
std::vector< Point > corners() const
Get all four corner points.
Rectangle scale(double factor) const
Scale rectangle by given factor (around center)
Point center() const
Get center point of rectangle.
Point top_right() const
Get top-right corner point.
Rectangle intersection(const Rectangle &other) const
Calculate intersection rectangle with another rectangle.
bool operator!=(const Rectangle &other) const
Inequality operator.
Rectangle & operator=(const Rectangle &other)=default
Assignment operator.
bool operator<(const Rectangle &other) const
Less than operator for sorting.
Rectangle()
Default constructor - creates empty rectangle at origin.
friend std::ostream & operator<<(std::ostream &os, const Rectangle &rect)
Stream output operator.
double height
Height of rectangle.
double right() const
Get right edge X coordinate.
Rectangle translate(const Point &offset) const
Translate rectangle by given offset.
static Rectangle bounding_box(const std::vector< Point > &points)
Create bounding rectangle for a set of points.
Point top_left() const
Get top-left corner point.
bool is_empty() const
Check if rectangle is empty (zero area)
Rectangle union_with(const Rectangle &other) const
Calculate union rectangle that contains both rectangles.
static Rectangle from_center(const Point ¢er, double width, double height)
Create rectangle from center point and dimensions.
bool intersects(const Rectangle &other) const
Check if this rectangle intersects with another rectangle.
Point bottom_right() const
Get bottom-right corner point.
bool contains_rectangle(const Rectangle &other) const
Check if another rectangle is completely inside this rectangle.
bool contains_point(const Point &point) const
Check if point is inside rectangle (inclusive of boundary)
Rectangle(const Rectangle &other)=default
Copy constructor.
Rectangle expand(double margin) const
Expand rectangle by given margin in all directions.
double x
X coordinate of bottom-left corner.
double distance_to(const Rectangle &other) const
Calculate minimum distance to another rectangle.
double perimeter() const
Calculate rectangle perimeter.
bool operator==(const Rectangle &other) const
Equality operator.
double width
Width of rectangle.
double bottom() const
Get bottom edge Y coordinate.
Main namespace for ZLayout library.
2D Point class for geometric calculations
Hash function for Rectangle (for use in std::unordered_map, etc.)
std::size_t operator()(const Rectangle &rect) const