36template <
typename ValueType>
58 : topLeft (rectangle.getTopLeft()),
59 topRight (rectangle.getTopRight()),
60 bottomLeft (rectangle.getBottomLeft())
71 bool isEmpty()
const noexcept {
return topLeft != topRight || topLeft != bottomLeft; }
74 inline bool isFinite()
const noexcept {
return topLeft.isFinite() && topRight.isFinite() && bottomLeft.isFinite(); }
133 template <
typename Po
intOrScalarType>
142 template <
typename Po
intOrScalarType>
145 topLeft *= scaleFactor;
146 topRight *= scaleFactor;
147 bottomLeft *= scaleFactor;
168 transform.transformPoints (p.topLeft.x, p.topLeft.y,
169 p.topRight.x, p.topRight.y,
170 p.bottomLeft.x, p.bottomLeft.y);
Represents a parallelogram that is defined by 3 points.
Parallelogram(Rectangle< ValueType > rectangle) noexcept
Creates a parallelogram from a rectangle.
ValueType getWidth() const noexcept
Returns the width of the parallelogram (i.e.
Parallelogram & operator+=(Point< ValueType > deltaPosition) noexcept
Moves this parallelogram by a given amount.
bool operator!=(const Parallelogram &other) const noexcept
Returns true if the two parallelograms are not identical.
Point< ValueType > getTopRight() const noexcept
Returns the parallelogram's top-right position as a Point.
Parallelogram()=default
Creates a parallelogram with zero size at the origin.
Parallelogram operator+(Point< ValueType > deltaPosition) const noexcept
Returns a parallelogram which is the same as this one moved by a given amount.
Parallelogram & operator-=(Point< ValueType > deltaPosition) noexcept
Moves this parallelogram by a given amount.
Parallelogram transformedBy(const AffineTransform &transform) const noexcept
Returns a transformed version of the parallelogram.
Parallelogram(Point< ValueType > topLeftPosition, Point< ValueType > topRightPosition, Point< ValueType > bottomLeftPosition) noexcept
Creates a parallelogram based on 3 points.
Point< ValueType > getTopLeft() const noexcept
Returns the parallelogram's top-left position as a Point.
Point< ValueType > getBottomLeft() const noexcept
Returns the parallelogram's bottom-left position as a Point.
Point< ValueType > getBottomRight() const noexcept
Returns the parallelogram's bottom-right position as a Point.
Point< ValueType > getRelativePoint(Point< ValueType > relativePosition) const noexcept
Returns a point within this parallelogram, specified as proportional coordinates.
Parallelogram operator*=(PointOrScalarType scaleFactor) noexcept
Scales this parallelogram by the given amount, centred around the origin.
Rectangle< ValueType > getBoundingBox() const noexcept
Returns the smallest rectangle that encloses this parallelogram.
bool isEmpty() const noexcept
Returns true if the parallelogram has a width or height of more than zero.
Parallelogram operator-(Point< ValueType > deltaPosition) const noexcept
Returns a parallelogram which is the same as this one moved by a given amount.
bool operator==(const Parallelogram &other) const noexcept
Returns true if the two parallelograms are identical.
bool isFinite() const noexcept
Returns true if the parallelogram's coordinates are all finite numbers, i.e.
Parallelogram operator*(PointOrScalarType scaleFactor) const noexcept
Returns a parallelogram that has been scaled by the given amount, centred around the origin.
ValueType getHeight() const noexcept
Returns the height of the parallelogram (i.e.
Parallelogram(const Parallelogram &)=default
Creates a copy of another parallelogram.
~Parallelogram()=default
Destructor.
A pair of (x, y) coordinates.
Manages a rectangle and allows geometric operations to be performed on it.
static Rectangle findAreaContainingPoints(const Point< ValueType > *points, int numPoints) noexcept
Returns the smallest Rectangle that can contain a set of points.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...