40#ifndef LIB2GEOM_SEEN_RECT_H
41#define LIB2GEOM_SEEN_RECT_H
115 bool isFinite()
const {
return (*
this)[
X].isFinite() && (*this)[
Y].isFinite(); }
124 return f[
X].interiorIntersects(r[
X]) &&
f[
Y].interiorIntersects(r[
Y]);
128 return f[
X].interiorContains(p[
X]) &&
f[
Y].interiorContains(p[
Y]);
133 return f[
X].interiorContains(r[
X]) &&
f[
Y].interiorContains(r[
Y]);
189 return f[
X] == ir[
X] &&
f[
Y] == ir[
Y];
215 if (r) *
this =
Rect(*r);
220 if (
empty())
return ret;
221 ret = (*this)->transformTo(viewport, aspect);
268 for(
unsigned i = 1; i < r.size(); i++)
pair< double, double > Point
3x3 affine transformation matrix.
3x3 matrix representing an affine transformation.
Axis-aligned generic rectangle that can be empty.
bool operator==(OptCRect const &other) const
Test for equality.
bool empty() const
Check for emptiness.
void intersectWith(CRect const &b)
Leave only the area overlapping with the argument.
Axis aligned, non-empty, generic rectangle.
Coord area() const
Compute the rectangle's area.
void unionWith(CRect const &b)
Enlarge the rectangle to contain the argument.
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
CPoint corner(unsigned i) const
Return the n-th corner of the rectangle.
CPoint max() const
Get the corner of the rectangle with largest coordinate values.
bool operator==(CRect const &o) const
Test for equality of rectangles.
Range of real numbers that is never empty.
Range of real numbers that can be empty.
Axis-aligned rectangle that can be empty.
OptRect(OptIntRect const &r)
GenericOptRect< Coord > Base
OptRect(Point const &a, Point const &b)
Affine transformTo(Rect const &viewport, Aspect const &aspect=Aspect())
OptRect(Coord x0, Coord y0, Coord x1, Coord y1)
bool operator==(Rect const &other) const
OptRect(IntRect const &r)
OptRect(OptInterval const &x_int, OptInterval const &y_int)
bool operator==(OptRect const &other) const
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
Rect shrunkBy(Coord amount) const
Return a new rectangle which results from shrinking this one by the same amount along both axes.
bool isFinite() const
Check whether the rectangle has finite area.
OptIntRect roundInwards() const
Return the largest integer rectangle which is contained in this one.
Rect expandedBy(Coord amount) const
Return a new rectangle which results from expanding this one by the same amount along both axes.
bool interiorContains(Rect const &r) const
Check whether the interior includes all points in the given rectangle.
IntRect roundOutwards() const
Return the smallest integer rectangle which contains this one.
bool operator==(IntRect const &ir) const
Rect(Point const &a, Point const &b)
Create a rectangle from two points.
bool operator==(Rect const &other) const
Rect & operator*=(Affine const &m)
Transform the rectangle by an affine.
Affine transformTo(Rect const &viewport, Aspect const &aspect=Aspect()) const
Transform contents to viewport.
GenericRect< Coord > Base
Coord diameter() const
Calculate the diameter of the smallest circle that would contain the rectangle.
bool interiorContains(Point const &p) const
Check whether the interior includes the given point.
bool hasZeroArea(Coord eps=EPSILON) const
Check whether the rectangle has zero area up to specified tolerance.
Coord distance(Point const &p, Rect const &rect)
Returns the smallest distance between p and rect.
Rect(Coord x0, Coord y0, Coord x1, Coord y1)
Rect()
Create a rectangle that contains only the point at (0,0).
bool interiorIntersects(Rect const &r) const
Check whether the interiors of the rectangles have any common points.
Rect(Interval const &a, Interval const &b)
Create a rectangle from X and Y intervals.
double Coord
Floating point type used to store coordinates.
constexpr Coord EPSILON
Default "acceptably small" value.
Axis-aligned rectangle with integer coordinates.
Simple closed interval class.
Various utility functions.
Expansion
Values for the <meetOrSlice> parameter of preserveAspectRatio.
Coord distanceSq(Point const &p, Rect const &rect)
Angle distance(Angle const &a, Angle const &b)
Align
Values for the <align> parameter of preserveAspectRatio.
IntRect unify(IntRect const &a, IntRect const &b)
OptIntRect operator&(IntRect const &a, IntRect const &b)
Rect union_list(std::vector< Rect > const &r)
Union a list of rectangles.
std::vector< Point > intersect(const xAx &C1, const xAx &C2)
Point align_factors(Align align)
Convert an align specification to coordinate fractions.
Structure that specifies placement of within a viewport.
Aspect(Align a=ALIGN_NONE, Expansion ex=EXPANSION_MEET)
bool deferred
for SVG compatibility