15 #ifndef RDKIT_STRINGRECT_H
16 #define RDKIT_STRINGRECT_H
21 namespace MolDraw2D_detail {
44 StringRect(
const Point2D &offset,
const Point2D &g_centre,
double w,
double h)
55 void calcCorners(Point2D &tl, Point2D &tr, Point2D &br, Point2D &bl,
56 double padding)
const {
57 double wb2 = padding +
width_ / 2.0;
58 double hb2 = padding +
height_ / 2.0;
61 tl = Point2D(c.x - wb2, c.y - hb2);
62 tr = Point2D(c.x + wb2, c.y - hb2);
63 br = Point2D(c.x + wb2, c.y + hb2);
64 bl = Point2D(c.x - wb2, c.y + hb2);
71 Point2D tl, tr, br, bl;
78 return pt.x >= tl.x && pt.x <= br.x && pt.y >= br.y && pt.y <= tl.y;
81 Point2D ttl, ttr, tbr, tbl;
88 Point2D otl, otr, obr, obl;
96 if ((otl.x >= ttl.x && otl.x <= ttr.x && otl.y >= tbl.y &&
98 (otr.x >= ttl.x && otr.x <= ttr.x && otr.y >= tbl.y &&
100 (obr.x >= ttl.x && obr.x <= ttr.x && obr.y >= tbl.y &&
102 (obl.x >= ttl.x && obl.x <= ttr.x && obl.y >= tbl.y &&
106 if ((ttl.x >= otl.x && ttl.x <= otr.x && ttl.y >= obl.y &&
108 (ttr.x >= otl.x && ttr.x <= otr.x && ttr.y >= obl.y &&
110 (tbr.x >= otl.x && tbr.x <= otr.x && tbr.y >= obl.y &&
112 (tbl.x >= otl.x && tbl.x <= otr.x && tbl.y >= obl.y &&
StringRect(const Point2D &offset, const Point2D &g_centre, double w, double h)
bool doesItIntersect(const StringRect &other, double padding=0.0) const
bool isPointInside(const Point2D &pt, double padding=0.0) const
void calcCorners(Point2D &tl, Point2D &tr, Point2D &br, Point2D &bl, double padding) const
void calcCentre(Point2D &c) const