30 Point2D(T xx=0,T yy=0);
36 inline void setXY(TT xx,TT yy);
37 inline void setXY(T xx,T yy);
41 inline T& operator[](
int idx);
42 inline T operator[](
int idx)
const;
54 inline Point2D<T> operator/(
const T den)
const;
58 inline bool isDefined()
const;
59 inline double abs()
const;
60 inline T sqAbs()
const;
79 Size2D( T w = 0 , T h = 0 );
84 inline T width()
const;
85 inline T height()
const;
86 inline void setWidth(T val);
87 inline void setHeight(T val);
116 Rectangle(T l=0,T t=0,T r=0,T b=0) ;
144 inline T width()
const;
145 inline T height()
const;
147 inline T
left()
const;
148 inline T top()
const;
149 inline T
right()
const;
150 inline T bottom()
const;
151 inline void setLeft(T val);
152 inline void setTop(T val);
153 inline void setRight(T val);
154 inline void setBottom(T val);
156 bool checkCorners(
bool leftislow=
true,
157 bool topislow=
true)
const;
159 void sortCorners(
bool leftislow=
true,
bool topislow=
true);
162 inline bool isDefined()
const;
169 inline void swapHor();
170 inline void swapVer();
172 inline bool revX()
const;
173 inline bool revY()
const;
200 inline bool isInside(
const Point2D<T>&)
const;
201 inline bool isOutside(
const Point2D<T>&)
const;
202 inline bool isOnSide(
const Point2D<T>&)
const;
203 inline bool contains(
const Point2D<T>&)
const;
211 inline bool xOutside(T)
const;
212 inline bool yOutside(T)
const;
234 {
return xOutside(p.
x,eps) || yOutside(p.
y,eps); }
235 inline bool isInside(
const Point2D<T>&,T eps)
const;
236 inline bool isOnSide(
const Point2D<T>& p,T eps)
const;
239 {
return !isOutside(p,eps); }
248 return other.
isInside(this->topleft_,eps)
249 && other.
isInside(this->bottomright_,eps);
256 inline bool xOutside(T,T)
const;
257 inline bool yOutside(T,T)
const;
261 template <
class T>
inline 266 template <
class T>
template <
class TT>
inline 268 {
x=a.
x;
y=a.
y;
return *
this;}
270 template <
class T>
inline 274 template <
class T>
template <
class TT>
inline 276 {
x = (T)xx;
y = (T)yy; }
278 template <
class T>
inline 280 {
x =
y = 0;
return *
this; }
282 template <
class T>
inline 287 template <
class T>
inline 289 {
return idx ?
y :
x; }
292 template <
class T>
inline 294 {
return idx ?
y :
x; }
297 template <
class T>
inline 299 {
return p.
x ==
x && p.
y ==
y; }
302 template <
class T>
inline 304 {
return !(*
this==p); }
306 template <
class T>
inline 308 {
x += dist;
y += dist;
return *
this; }
311 template <
class T>
inline 313 {
x *= factor;
y *= factor;
return *
this; }
316 template <
class T>
inline 318 {
x /= den;
y /= den;
return *
this; }
321 template <
class T>
inline 323 {
x += p.
x;
y += p.
y;
return *
this; }
326 template <
class T>
inline 328 {
x -= p.
x;
y -= p.
y;
return *
this; }
331 template <
class T>
inline 336 template <
class T>
inline 341 template <
class T>
inline 346 template <
class T>
inline 351 template <
class T>
inline 356 template <
class T>
inline 363 template <
class T>
inline 368 template <
class T>
inline 370 {
return x*
x +
y*
y; }
373 template <
class T>
inline 378 template <
class T>
inline 381 const T xdiff =
x-pt.
x;
382 const T ydiff =
y-pt.
y;
383 return xdiff*xdiff + ydiff*ydiff;
387 template <
class T>
inline 389 { width_=w; height_=h; }
392 template <
class T>
inline 397 template <
class T>
inline 402 template <
class T>
inline 407 template <
class T>
inline 412 template <
class T>
inline 417 template <
class T>
inline 422 template <
class T>
inline 424 {
return Size2D<T>( width_+val, height_+val); }
427 template <
class T>
inline 429 { width_ += val; height_ += val;
return *
this; }
432 template <
class T>
inline 434 { width_ -= val; height_ -= val;
return *
this; }
437 template <
class T>
inline 442 template <
class T>
inline 446 if ( width_<0 ) width_ = -width_;
447 if ( height_<0 ) height_ = -height_;
452 template <
class T>
inline 455 , bottomright_(
Point2D<T>(r,b) )
459 template <
class T>
inline 465 template <
class T>
inline 471 template <
class T>
inline 476 template <
class T>
inline 481 template <
class T>
inline 486 template <
class T>
inline 491 template <
class T>
inline 496 template <
class T>
inline 501 template <
class T>
inline 509 template <
class T>
inline 514 template <
class T>
inline 519 template <
class T>
inline 524 template <
class T>
inline 529 template <
class T>
inline 534 template <
class T>
inline 539 template <
class T>
inline 553 template <
class T>
inline 558 template <
class T>
inline 563 template <
class T>
inline 568 template <
class T>
inline 573 template <
class T>
inline 578 template <
class T>
inline 583 template <
class T>
inline 588 template <
class T>
inline 593 template <
class T>
inline 598 template <
class T>
inline 603 template <
class T>
inline 606 if ( leftislow == (
left() >
right()) )
return false;
607 if ( topislow == (
top() >
bottom()) )
return false;
613 template <
class T>
inline 621 template <
class T>
inline 626 template <
class T>
inline 631 template <
class T>
inline 636 template <
class T>
inline 641 template <
class T>
inline 646 template <
class T>
inline 651 template <
class T>
inline 656 template <
class T>
inline 665 template <
class T>
inline 674 template <
class T>
inline 679 template <
class T>
inline 687 return this->
revX() ? (x > this->
left() || x < this->
right())
688 : (x < this->
left() || x > this->
right());
695 return this->
revY() ? (y > this->
bottom() || y < this->
top())
696 : (y < this->
bottom() || y > this->
top());
703 return (pt.
x == this->left() || pt.
x == this->
right())
704 && (pt.
y == this->top() || pt.
y == this->
bottom());
711 return this->
revX() ? (x-this->
left() > eps || this->
right()-x > eps)
712 : (this->
left()-x > eps || x-this->
right() > eps);
719 return this->
revY() ? (this->
top()-y > eps || y-this->
bottom() > eps)
720 : (y-this->
top() > eps || this->
bottom()-y > eps);
727 if ( xOutside(pt.
x) || yOutside(pt.
y) )
return false;
728 return fabs(pt.
x - this->left()) < eps || fabs(pt.
x - this->right()) < eps
729 || fabs(pt.
y - this->top()) < eps || fabs(pt.
y - this->bottom()) < eps;
736 return (this->
revX() ? (this->
left()-pt.
x>eps && pt.
x-this->right()>eps)
737 : (pt.
x-this->left()>eps && this->
right()-pt.
x>eps))
739 : (this->
bottom()-pt.
y<-eps && pt.
y-this->
top()<-eps));
745 {
return (T)
mNINT32(x1 + f * (x1 - x2)); }
750 {
return x1 + f * (x1 - x2); }
777 template <
class T>
inline 782 template <
class T>
inline 787 template <
class T>
inline 792 template <
class T>
inline 799 template <
class T>
inline 806 template <
class T>
inline 811 iwiderPos<T>(this->
top(),this->
bottom(),f),
812 iwiderPos<T>(this->
right(),this->
left(),f),
813 iwiderPos<T>(this->
bottom(),this->
top(),f) );
833 if ( diff.width() > 0 && diff.height() > 0 )
835 if ( diff.width() < 0 && diff.height() < 0 )
838 return diff.
width() < 0 ? diff.height() < -diff.width()
839 : diff.width() > -diff.height();
void translate(const Point2D< T > &)
Definition: geometry.h:852
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
T width() const
Definition: geometry.h:554
bool operator!=(const Rectangle< T > &) const
Definition: geometry.h:477
Rectangle< T > & operator-=(const Point2D< T > &)
Definition: geometry.h:642
bool isOnSide(const Point2D< T > &) const
Definition: geometry.h:701
int operator-(const DateInfo &di1, const DateInfo &di2)
Definition: dateinfo.h:129
Integer rectangle class.
Definition: geometry.h:192
T left() const
Definition: geometry.h:564
void setXY(TT xx, TT yy)
Definition: geometry.h:275
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Point2D< T > bottomLeft() const
Definition: geometry.h:492
Size2D< T > & operator-=(T val)
Definition: geometry.h:433
void zero()
Definition: geometry.h:627
if(!noudf_ &&(mIsUdf(inpval)))
Definition: arrayndalgo.h:1662
Point2D< T > operator/(const T den) const
Definition: geometry.h:347
void setTop(T val)
Definition: geometry.h:589
void setWidth(T val)
Definition: geometry.h:413
void include(const Rectangle< T > &)
Definition: geometry.h:860
PosRectangle< T > grownBy(T sidesincreasebyfactor=1) const
Definition: geometry.h:818
void sortCorners(bool leftislow=true, bool topislow=true)
Definition: geometry.h:614
PixRectangle(T l=0, T t=0, T r=0, T b=0)
Definition: geometry.h:754
Definition: i_layout.h:28
T width_
Definition: geometry.h:96
Size2D< T > operator+(T val) const
Definition: geometry.h:423
void limitTo(const Rectangle< T > &)
Definition: geometry.h:844
void setTopLeft(Point2D< T >)
Definition: geometry.h:510
bool yOutside(T, T) const
Definition: geometry.h:717
Point2D< T > bottomright_
Definition: geometry.h:178
T width() const
Definition: geometry.h:403
Point2D< T > & operator/=(T den)
Definition: geometry.h:317
bool isOutside(const Point2D< T > &) const
Definition: geometry.h:783
bool isInside(const Point2D< T > &, T eps) const
Definition: geometry.h:734
static Point2D< T > udf()
Definition: geometry.h:64
Size2D< T > & operator+=(T val)
Definition: geometry.h:428
T sqDistTo(const Point2D< T > &) const
Definition: geometry.h:379
T bottom() const
Definition: geometry.h:579
PixRectangle< T > grownBy(double sidesincreasebyfactor=1) const
Definition: geometry.h:807
bool operator==(const Point2D< T > &) const
Definition: geometry.h:298
Point2D< T > bottomRight() const
Definition: geometry.h:497
double distTo(const Point2D< T > &) const
Definition: geometry.h:374
void setBottom(T val)
Definition: geometry.h:599
#define mMIN(x, y)
Definition: commondefs.h:49
Interval of values.
Definition: commontypes.h:31
bool operator>(const Rectangle< T > &) const
Definition: geometry.h:829
bool isOutside(const Point2D< T > &p, T eps) const
Definition: geometry.h:233
bool contains(const Point2D< T > &p, T eps) const
Definition: geometry.h:238
Basic 2D sizes (width/height) class.
Definition: geometry.h:76
void swapXY()
Definition: geometry.h:357
PosRectangle(Point2D< T > tl, Point2D< T > br)
Definition: geometry.h:230
T height() const
Definition: geometry.h:559
T sqAbs() const
Definition: geometry.h:369
bool isInside(const Point2D< T > &) const
Definition: geometry.h:778
#define mNINT32(x)
Definition: commondefs.h:45
Point2D< T > topRight() const
Definition: geometry.h:487
Size2D(T w=0, T h=0)
Definition: geometry.h:388
bool contains(const PosRectangle< T > &other, T eps) const
Definition: geometry.h:241
void setBottomRight(Point2D< T >)
Definition: geometry.h:515
bool yOutside(T) const
Definition: geometry.h:693
Rectangle(T l=0, T t=0, T r=0, T b=0)
Definition: geometry.h:453
PosRectangle(T l=0, T t=0, T r=0, T b=0)
Definition: geometry.h:228
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
bool checkCorners(bool leftislow=true, bool topislow=true) const
Definition: geometry.h:604
Rectangle< T > & operator+=(const Point2D< T > &)
Definition: geometry.h:637
T y
Definition: geometry.h:67
void swapHor()
Definition: geometry.h:657
void setRight(T val)
Definition: geometry.h:594
bool isDefined() const
Definition: geometry.h:352
double abs() const
Definition: geometry.h:364
void Swap(T &a, T &b)
Definition: commondefs.h:36
T & operator[](int idx)
Definition: geometry.h:288
bool isDefined() const
Definition: geometry.h:632
Size2D< T > size() const
Definition: geometry.h:622
Point2D< T > moveInside(const Point2D< T > &) const
Definition: geometry.h:540
void setLeft(T val)
Definition: geometry.h:584
T top() const
Definition: geometry.h:569
void setTopRight(Point2D< T >)
Definition: geometry.h:520
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
Basic 2D rectangle class.
Definition: geometry.h:113
T height_
Definition: geometry.h:97
T iwiderPos(int x1, int x2, double f)
Definition: geometry.h:744
Point2D< T > centre() const
Definition: geometry.h:502
Point2D< T > & operator*=(T factor)
Definition: geometry.h:312
Coord3 operator*(double f, const Coord3 &b)
Definition: coord.h:130
bool contains(const Point2D< T > &) const
Definition: geometry.h:788
bool revX() const
Definition: geometry.h:675
T stop
Definition: ranges.h:93
Point2D< T > operator*(const T factor) const
Definition: geometry.h:342
void swapVer()
Definition: geometry.h:666
void setBottomLeft(Point2D< T >)
Definition: geometry.h:525
T x
Definition: geometry.h:66
bool operator==(const Size2D< T > &) const
Definition: geometry.h:393
Point2D< T > topleft_
Definition: geometry.h:177
void setLeftRight(const Interval< T > &)
Definition: geometry.h:535
T fwiderPos(T x1, T x2, T f)
Definition: geometry.h:749
bool isOnSide(const Point2D< T > &p, T eps) const
Definition: geometry.h:725
bool operator!=(const Size2D< T > &) const
Definition: geometry.h:398
Point2D(T xx=0, T yy=0)
Definition: geometry.h:262
Point2D< T > operator+(const Point2D< T > &) const
Definition: geometry.h:332
T start
Definition: ranges.h:92
Point2D< T > topLeft() const
Definition: geometry.h:482
Definition: geometry.h:19
T right() const
Definition: geometry.h:574
#define mClass(module)
Definition: commondefs.h:164
Basic point class.
Definition: geometry.h:27
bool xOutside(T) const
Definition: geometry.h:685
Point2D< T > & setFrom(const Point2D< TT > &)
Definition: geometry.h:267
Point2D< T > & operator-=(const Point2D< T > &)
Definition: geometry.h:327
bool revY() const
Definition: geometry.h:680
Point2D< T > & zero()
Definition: geometry.h:279
bool isInside(const PosRectangle< T > &other, T eps) const
Definition: geometry.h:246
void setTopBottom(const Interval< T > &)
Definition: geometry.h:530
Point2D< T > & operator+=(T dist)
Definition: geometry.h:307
T height() const
Definition: geometry.h:408
bool operator!=(const Point2D< T > &) const
Definition: geometry.h:303
#define mMAX(x, y)
Definition: commondefs.h:48
bool xOutside(T, T) const
Definition: geometry.h:709
Floating-point rectangle class.
Definition: geometry.h:225
void setHeight(T val)
Definition: geometry.h:418
bool operator==(const Rectangle< T > &) const
Definition: geometry.h:472
Point2D< T > operator-()
Definition: geometry.h:283
Definition: i_layout.h:28