Lines Matching defs:rect
32 #include <2geom/rect.h>
130 Coord distanceSq(Point const &p, Rect const &rect)
133 if ( p[X] < rect.left() ) {
134 dx = p[X] - rect.left();
135 } else if ( p[X] > rect.right() ) {
136 dx = rect.right() - p[X];
138 if (p[Y] < rect.top() ) {
139 dy = rect.top() - p[Y];
140 } else if ( p[Y] > rect.bottom() ) {
141 dy = p[Y] - rect.bottom();
146 /** @brief Returns the smallest distance between p and rect.
148 Coord distance(Point const &p, Rect const &rect)
152 if ( p[X] < rect.left() ) {
153 dx = p[X] - rect.left();
154 } else if ( p[X] > rect.right() ) {
155 dx = rect.right() - p[X];
157 if (p[Y] < rect.top() ) {
158 dy = rect.top() - p[Y];
159 } else if ( p[Y] > rect.bottom() ) {
160 dy = p[Y] - rect.bottom();
165 Coord distanceSq(Point const &p, OptRect const &rect)
167 if (!rect) return std::numeric_limits<Coord>::max();
168 return distanceSq(p, *rect);
170 Coord distance(Point const &p, OptRect const &rect)
172 if (!rect) return std::numeric_limits<Coord>::max();
173 return distance(p, *rect);