19 #ifndef EZGL_RECTANGLE_HPP
20 #define EZGL_RECTANGLE_HPP
22 #include "ezgl/point.hpp"
202 return !(rhs == *
this);
Represents a two-dimensional point.
Definition: point.hpp:27
double y
Location of the y-coordinate.
Definition: point.hpp:51
double x
Location of the x-coordinate.
Definition: point.hpp:46
Represents a rectangle as two diagonally opposite points.
Definition: rectangle.hpp:31
friend rectangle operator-(rectangle &lhs, point2d const &rhs)
Create a new rectangle that is translated (negative offsets).
Definition: rectangle.hpp:230
double center_y() const
The center of the rectangle in the y plane.
Definition: rectangle.hpp:176
double left() const
The minimum x-coordinate.
Definition: rectangle.hpp:59
double bottom() const
The minimum y-coordinate.
Definition: rectangle.hpp:75
friend rectangle & operator-=(rectangle &lhs, point2d const &rhs)
translate the rectangle by negative offsets.
Definition: rectangle.hpp:219
double right() const
The maximum x-coordinate.
Definition: rectangle.hpp:67
point2d center() const
The center of the recangle.
Definition: rectangle.hpp:184
double top() const
The maximum y-coordinate.
Definition: rectangle.hpp:83
point2d m_first
The first point of the rectangle.
Definition: rectangle.hpp:244
point2d bottom_right() const
The maximum x-coordinate and the minimum y-coordinate.
Definition: rectangle.hpp:107
friend rectangle & operator+=(rectangle &lhs, point2d const &rhs)
translate the rectangle by positive offsets.
Definition: rectangle.hpp:208
double center_x() const
The center of the rectangle in the x plane.
Definition: rectangle.hpp:168
rectangle(point2d origin_pt, point2d top_right_pt)
Create a rectangle from two diagonally opposite points.
Definition: rectangle.hpp:43
rectangle(point2d origin_pt, double rec_width, double rec_height)
Create a rectangle with a given width and height.
Definition: rectangle.hpp:50
bool contains(double x, double y) const
Test if the x and y values are within the rectangle.
Definition: rectangle.hpp:123
double width() const
The width of the rectangle.
Definition: rectangle.hpp:143
point2d bottom_left() const
The minimum x-coordinate and the minimum y-coordinate.
Definition: rectangle.hpp:91
double area() const
The area of the rectangle.
Definition: rectangle.hpp:160
point2d m_second
The second point of the rectangle.
Definition: rectangle.hpp:247
double height() const
The height of the rectangle.
Definition: rectangle.hpp:151
bool contains(point2d point) const
Test if the x and y values are within the rectangle.
Definition: rectangle.hpp:135
point2d top_left() const
The minimum x-coordinate and the maximum y-coordinate.
Definition: rectangle.hpp:99
rectangle()
Default constructor: Create a zero-sized rectangle at {0,0}.
Definition: rectangle.hpp:36
bool operator==(const rectangle &rhs) const
Test for equality.
Definition: rectangle.hpp:192
friend rectangle operator+(rectangle &lhs, point2d const &rhs)
Create a new rectangle that is translated (positive offsets).
Definition: rectangle.hpp:238
bool operator!=(const rectangle &rhs) const
Test for inequality.
Definition: rectangle.hpp:200
point2d top_right() const
The maximum x-coordinate and the maximum y-coordinate.
Definition: rectangle.hpp:115
A library for creating a graphical user interface.
Definition: application.hpp:40