OpendTect  6.6
geometry.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H. Lammertink
8  Date: 01/02/2000
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "gendefs.h"
15 #include "ranges.h"
16 #include "math2.h"
17 
18 namespace Geom
19 {
20 
25 template <class T>
27 {
28 public:
29  Point2D(T xx=0,T yy=0);
30 
31  template <class TT>
33 
34  template <class TT>
35  inline void setXY(TT xx,TT yy);
36  inline void setXY(T xx,T yy);
37  inline Point2D<T>& zero();
39 
40  inline T& operator[](int idx);
41  inline T operator[](int idx) const;
42 
43  inline bool operator==(const Point2D<T>&) const;
44  inline bool operator!=(const Point2D<T>&) const;
45  inline Point2D<T>& operator+=(T dist);
46  inline Point2D<T>& operator*=(T factor);
47  inline Point2D<T>& operator/=(T den);
48  inline Point2D<T>& operator+=(const Point2D<T>&);
49  inline Point2D<T>& operator-=(const Point2D<T>&);
50  inline Point2D<T> operator+(const Point2D<T>&) const;
51  inline Point2D<T> operator-(const Point2D<T>&) const;
52  inline Point2D<T> operator*(const T factor) const;
53  inline Point2D<T> operator/(const T den) const;
54 
55  inline void swapXY();
56 
57  inline bool isDefined() const;
58  inline double abs() const;
59  inline T sqAbs() const;
60  inline double distTo(const Point2D<T>&) const;
61  inline T sqDistTo(const Point2D<T>&) const;
62  template <class TT>
63  inline Point2D<T> scale(TT xx,TT yy) const;
64 
65  static Point2D<T> udf() { return Point2D<T>(mUdf(T),mUdf(T)); }
66 
67  T x;
68  T y;
69 };
70 
74 
79 template <class T>
80 mClass(Basic) Size2D
81 {
82 public:
83  Size2D(T w=0 ,T h=0);
84 
85  inline bool operator==(const Size2D<T>&) const;
86  inline bool operator!=(const Size2D<T>&) const;
87 
88  inline T width() const;
89  inline T height() const;
90  inline void setWidth(T val);
91  inline void setHeight(T val);
92  inline Size2D<T> operator+(T val) const;
93  inline Size2D<T>& operator+=(T val);
94  inline Size2D<T>& operator-=(T val);
95  inline Size2D<T>& operator+=(const Size2D<T>&);
96  inline Size2D<T>& operator-=(const Size2D<T>&);
97 
98 protected:
99 
102 
103 };
104 
105 
116 template <class T>
118 {
119 public:
120  Rectangle(T l=0,T t=0,T r=0,T b=0) ;
121  Rectangle(const Point2D<T>& tl,const Point2D<T>& br);
122  Rectangle(const Point2D<T>& tl,const Size2D<T>& sz);
123 
124  inline bool operator==(const Rectangle<T>&) const;
125  inline bool operator!=(const Rectangle<T>&) const;
126 
127  inline Point2D<T> topLeft() const;
128  inline Point2D<T> topRight() const;
129  inline Point2D<T> bottomLeft() const;
130  inline Point2D<T> bottomRight() const;
131  inline Point2D<T> centre() const;
132  inline void setTopLeft(Point2D<T>);
134  inline void setTopRight(Point2D<T>);
135  inline void setBottomLeft(Point2D<T>);
136  inline void setTopBottom(const Interval<T>&);
137  inline void setLeftRight(const Interval<T>&);
138 
139  inline Point2D<T> moveInside(const Point2D<T>&) const;
140 
141  inline void include(const Rectangle<T>&);
142  inline void include(const Point2D<T>&);
143  inline void limitTo(const Rectangle<T>&);
144  inline void translate(const Point2D<T>&);
145 
146  inline bool operator >(const Rectangle<T>&) const;
147 
148  inline T width() const;
149  inline T height() const;
150 
151  inline T left() const;
152  inline T top() const;
153  inline T right() const;
154  inline T bottom() const;
155  inline void setLeft(T val);
156  inline void setTop(T val);
157  inline void setRight(T val);
158  inline void setBottom(T val);
159 
160  bool checkCorners(bool leftislow=true,
161  bool topislow=true) const;
163  void sortCorners(bool leftislow=true,bool topislow=true);
164  inline Size2D<T> size() const;
165  inline void zero();
166  inline bool isDefined() const;
167 
168  inline Rectangle<T>& operator+=(const Point2D<T>&); // shifts
170  inline Rectangle<T>& operator+=(const Size2D<T>&); // keeps topleft in place
172 
173  inline void swapHor();
174  inline void swapVer();
175 
176  inline bool revX() const;
177  inline bool revY() const;
178 
179 protected:
180 
183 
184 };
185 
186 
195 template <class T>
197 {
198 public:
199  PixRectangle(T l=0 , T t=0, T r=0 , T b=0 ) ;
200  PixRectangle(const Point2D<T>& tl,const Point2D<T>& br);
201  PixRectangle(const Point2D<T>& tl,const Size2D<T>& sz);
203 
204  inline bool isInside(const Point2D<T>&) const;
205  inline bool isOutside(const Point2D<T>&) const;
206  inline bool isOnSide(const Point2D<T>&) const;
207  inline bool contains(const Point2D<T>&) const;
208  inline bool contains(const PixRectangle<T>&) const;
209  inline bool isInside(const PixRectangle<T>&) const;
210 
211  inline PixRectangle<T> grownBy(double sidesincreasebyfactor=1) const;
212 
213 protected:
214 
215  inline bool xOutside(T) const;
216  inline bool yOutside(T) const;
217 };
218 
219 
228 template <class T>
230 {
231 public:
232  PosRectangle( T l = 0 , T t = 0, T r = 0 , T b = 0 )
233  : Rectangle<T>(l,t,r,b) {}
235  : Rectangle<T>(tl,br) {}
236 
237  inline bool isOutside( const Point2D<T>& p, T eps ) const
238  { return xOutside(p.x,eps) || yOutside(p.y,eps); }
239  inline bool isInside(const Point2D<T>&,T eps) const;
240  inline bool isOnSide(const Point2D<T>& p,T eps) const;
241 
242  inline bool contains( const Point2D<T>& p, T eps ) const
243  { return !isOutside(p,eps); }
244 
245  inline bool contains( const PosRectangle<T>& other, T eps ) const
246  {
247  return contains(other.topleft_,eps)
248  && contains(other.bottomright_,eps);
249  }
250  inline bool isInside( const PosRectangle<T>& other, T eps ) const
251  {
252  return other.isInside(this->topleft_,eps)
253  && other.isInside(this->bottomright_,eps);
254  }
255 
256  inline PosRectangle<T> grownBy(T sidesincreasebyfactor=1) const;
257 
258  template <class TT>
259  inline PosRectangle<T> scale(TT xx,TT yy) const;
260 
261 protected:
262 
263  inline bool xOutside(T,T) const;
264  inline bool yOutside(T,T) const;
265 };
266 
267 
271 
272 
273 template <class T> inline
274 Point2D<T>::Point2D ( T xx , T yy )
275  : x(xx), y(yy)
276 {}
277 
278 template <class T> template <class TT> inline
280 { x=a.x; y=a.y; return *this;}
281 
282 template <class T> inline
283 void Point2D<T>::setXY( T xx, T yy )
284 { x = xx ; y = yy; }
285 
286 template <class T> template <class TT> inline
287 void Point2D<T>::setXY( TT xx, TT yy )
288 { x = sCast(T,xx); y = sCast(T,yy); }
289 
290 template <class T> inline
292 { x = y = 0; return *this; }
293 
294 template <class T> inline
296 { return Point2D<T>( -x, -y ); }
297 
298 
299 template <class T> inline
301 { return idx ? y : x; }
302 
303 
304 template <class T> inline
305 T Point2D<T>::operator[]( int idx ) const
306 { return idx ? y : x; }
307 
308 
309 template <class T> inline
310 bool Point2D<T>::operator ==( const Point2D<T>& p ) const
311 { return p.x == x && p.y == y; }
312 
313 
314 template <class T> inline
315 bool Point2D<T>::operator !=( const Point2D<T>& p ) const
316 { return !(*this==p); }
317 
318 template <class T> inline
320 { x += dist; y += dist; return *this; }
321 
322 
323 template <class T> inline
325 { x *= factor; y *= factor; return *this; }
326 
327 
328 template <class T> inline
330 { x /= den; y /= den; return *this; }
331 
332 
333 template <class T> inline
335 { x += p.x; y += p.y; return *this; }
336 
337 
338 template <class T> inline
340 { x -= p.x; y -= p.y; return *this; }
341 
342 
343 template <class T> inline
345 { return Point2D<T>(x+p.x,y+p.y); }
346 
347 
348 template <class T> inline
350 { return Point2D<T>(x-p.x,y-p.y); }
351 
352 
353 template <class T> inline
354 Point2D<T> Point2D<T>::operator *( const T factor ) const
355 { return Point2D<T>(factor*x,factor*y); }
356 
357 
358 template <class T> inline
359 Point2D<T> Point2D<T>::operator /( const T den ) const
360 { return Point2D<T>(x/den,y/den); }
361 
362 
363 template <class T> inline
365 { return !mIsUdf(x) && !mIsUdf(y); }
366 
367 
368 template <class T> inline
370 {
371  Swap( x, y );
372 }
373 
374 
375 template <class T> inline
376 double Point2D<T>::abs() const
377 { return ::Math::Sqrt( sCast(double,sqAbs()) ); }
378 
379 
380 template <class T> inline
382 { return x*x + y*y; }
383 
384 
385 template <class T> inline
386 double Point2D<T>::distTo( const Point2D<T>& pt ) const
387 { return ::Math::Sqrt( sCast(double,sqDistTo(pt)) ); }
388 
389 
390 template <class T> inline
391 T Point2D<T>::sqDistTo( const Point2D<T>& pt ) const
392 {
393  const T xdiff = x-pt.x;
394  const T ydiff = y-pt.y;
395  return xdiff*xdiff + ydiff*ydiff;
396 }
397 
398 
399 template <class T> template <class TT> inline
400 Point2D<T> Point2D<T>::scale( TT xx, TT yy ) const
401 { return Point2D<T>( x*sCast(T,xx), y*sCast(T,yy) ); }
402 
403 
404 // Size2D
405 template <class T> inline
406 Size2D<T>::Size2D( T w , T h )
407 { width_=w; height_=h; }
408 
409 
410 template <class T> inline
411 bool Size2D<T>::operator ==( const Size2D<T>& s ) const
412 { return s.width_ == width_ && s.height_ == height_; }
413 
414 
415 template <class T> inline
416 bool Size2D<T>::operator !=( const Size2D<T>& s ) const
417 { return s.width_ != width_ || s.height_ != height_; }
418 
419 
420 template <class T> inline
422 { return width_; }
423 
424 
425 template <class T> inline
427 { return height_; }
428 
429 
430 template <class T> inline
431 void Size2D<T>::setWidth( T val )
432 { width_ = val; }
433 
434 
435 template <class T> inline
436 void Size2D<T>::setHeight( T val )
437 { height_ = val; }
438 
439 
440 template <class T> inline
442 { return Size2D<T>( width_+val, height_+val); }
443 
444 
445 template <class T> inline
447 { width_ += val; height_ += val; return *this; }
448 
449 
450 template <class T> inline
452 { width_ -= val; height_ -= val; return *this; }
453 
454 
455 template <class T> inline
457 { width_+=s.width_; height_+=s.height_; return *this; }
458 
459 
460 template <class T> inline
462 {
463  width_ -= s.width_; height_ -= s.height_;
464  if ( width_<0 ) width_ = -width_;
465  if ( height_<0 ) height_ = -height_;
466  return *this;
467 }
468 
469 
470 // Rectangle
471 template <class T> inline
472 Rectangle<T>::Rectangle( T l, T t, T r, T b )
473  : topleft_( Point2D<T>(l,t))
474  , bottomright_( Point2D<T>(r,b) )
475 {}
476 
477 
478 template <class T> inline
480  : topleft_( tl ) , bottomright_( br )
481 {}
482 
483 
484 template <class T> inline
486  : topleft_( tl ) , bottomright_( tl.x+sz.width(), tl.y+sz.height() )
487 {}
488 
489 
490 template <class T> inline
492 { return r.topleft_ == topleft_ && r.bottomright_ == bottomright_; }
493 
494 
495 template <class T> inline
497 { return r.topleft_ != topleft_ || r.bottomright_ != bottomright_; }
498 
499 
500 template <class T> inline
502 { return topleft_; }
503 
504 
505 template <class T> inline
507 { return Point2D<T>(right(),top()); }
508 
509 
510 template <class T> inline
512 { return Point2D<T>(left(),bottom()); }
513 
514 
515 template <class T> inline
517 { return bottomright_; }
518 
519 
520 template <class T> inline
522 {
523  return Point2D<T>( (topleft_.x+bottomright_.x)/2,
524  (topleft_.y+bottomright_.y)/2 );
525 }
526 
527 
528 template <class T> inline
530 { topleft_ = tl; }
531 
532 
533 template <class T> inline
535 { bottomright_ = br; }
536 
537 
538 template <class T> inline
540 { topleft_.y = tr.y; bottomright_.x = tr.x; }
541 
542 
543 template <class T> inline
545 { topleft_.x = tr.x; bottomright_.y = tr.y; }
546 
547 
548 template <class T> inline
550 { topleft_.y = rg.start; bottomright_.y = rg.stop; }
551 
552 
553 template <class T> inline
555 { topleft_.x = rg.start; bottomright_.x = rg.stop; }
556 
557 
558 template <class T> inline
560 {
561  Point2D<T> res = pt;
562 
563  res.x = mMAX( res.x, mMIN( left(), right() ) );
564  res.x = mMIN( res.x, mMAX( left(), right() ) );
565  res.y = mMAX( res.y, mMIN( bottom(), top() ) );
566  res.y = mMIN( res.y, mMAX( bottom(), top() ) );
567 
568  return res;
569 }
570 
571 
572 template <class T> inline
574 { return revX() ? left()-right() : right() - left(); }
575 
576 
577 template <class T> inline
579 { return revY() ? bottom()-top() : top()-bottom(); }
580 
581 
582 template <class T> inline
584 { return topleft_.x; }
585 
586 
587 template <class T> inline
589 { return topleft_.y; }
590 
591 
592 template <class T> inline
594 { return bottomright_.x; }
595 
596 
597 template <class T> inline
599 { return bottomright_.y; }
600 
601 
602 template <class T> inline
604 { topleft_.x = val; }
605 
606 
607 template <class T> inline
608 void Rectangle<T>::setTop( T val )
609 { topleft_.y = val; }
610 
611 
612 template <class T> inline
614 { bottomright_.x = val; }
615 
616 
617 template <class T> inline
619 { bottomright_.y = val; }
620 
621 
622 template <class T> inline
623 bool Rectangle<T>::checkCorners( bool leftislow, bool topislow ) const
624 {
625  if ( leftislow == (left() > right()) ) return false;
626  if ( topislow == (top() > bottom()) ) return false;
627 
628  return true;
629 }
630 
631 
632 template <class T> inline
633 void Rectangle<T>::sortCorners( bool leftislow, bool topislow )
634 {
635  if ( leftislow == (left() > right()) ) swapHor();
636  if ( topislow == (top() > bottom()) ) swapVer();
637 }
638 
639 
640 template <class T> inline
642 { return Size2D<T>( width(), height() ); }
643 
644 
645 template <class T> inline
647 { topleft_.zero(); bottomright_.zero(); }
648 
649 
650 template <class T> inline
652 { return topleft_.isDefined() && bottomright_.isDefined(); }
653 
654 
655 template <class T> inline
657 { topleft_ += p; bottomright_ += p; return *this; }
658 
659 
660 template <class T> inline
662 { topleft_ -= p; bottomright_ -= p; return *this; }
663 
664 
665 template <class T> inline
667 { bottomright_.x += sz.width(); bottomright_.y += sz.height(); return *this; }
668 
669 
670 template <class T> inline
672 { bottomright_.x -= sz.width(); bottomright_.y -= sz.height(); return *this; }
673 
674 
675 template <class T> inline
677 {
678  T t = topleft_.x;
679  topleft_.x = bottomright_.x;
680  bottomright_.x = t;
681 }
682 
683 
684 template <class T> inline
686 {
687  T t = topleft_.y;
688  topleft_.y = bottomright_.y;
689  bottomright_.y = t;
690 }
691 
692 
693 template <class T> inline
694 bool Rectangle<T>::revX() const
695 { return left() > right(); }
696 
697 
698 template <class T> inline
699 bool Rectangle<T>::revY() const
700 { return bottom() > top(); }
701 
702 
703 // PixRectangle
704 template <class T>
705 inline bool PixRectangle<T>::xOutside( T x ) const
706 {
707  return this->revX() ? (x > this->left() || x < this->right())
708  : (x < this->left() || x > this->right());
709 }
710 
711 
712 template <class T>
713 inline bool PixRectangle<T>::yOutside( T y ) const
714 {
715  return this->revY() ? (y > this->bottom() || y < this->top())
716  : (y < this->bottom() || y > this->top());
717 }
718 
719 
720 template <class T>
721 inline bool PixRectangle<T>::isOnSide( const Point2D<T>& pt ) const
722 {
723  return (pt.x == this->left() || pt.x == this->right())
724  && (pt.y == this->top() || pt.y == this->bottom());
725 }
726 
727 
728 // PosRectangle
729 template <class T>
730 inline bool PosRectangle<T>::xOutside( T x, T eps ) const
731 {
732  return this->revX() ? (x-this->left() > eps || this->right()-x > eps)
733  : (this->left()-x > eps || x-this->right() > eps);
734 }
735 
736 
737 template <class T>
738 inline bool PosRectangle<T>::yOutside( T y, T eps ) const
739 {
740  return this->revY() ? (this->top()-y > eps || y-this->bottom() > eps)
741  : (y-this->top() > eps || this->bottom()-y > eps);
742 }
743 
744 
745 template <class T>
746 inline bool PosRectangle<T>::isOnSide( const Point2D<T>& pt, T eps ) const
747 {
748  if ( xOutside(pt.x) || yOutside(pt.y) ) return false;
749  return fabs(pt.x - this->left()) < eps || fabs(pt.x - this->right()) < eps
750  || fabs(pt.y - this->top()) < eps || fabs(pt.y - this->bottom()) < eps;
751 }
752 
753 
754 template <class T>
755 inline bool PosRectangle<T>::isInside( const Point2D<T>& pt, T eps ) const
756 {
757  return (this->revX() ? (this->left()-pt.x>eps && pt.x-this->right()>eps)
758  : (pt.x-this->left()>eps && this->right()-pt.x>eps))
759  && (this->revY() ? (pt.y-this->bottom()<-eps && this->top()-pt.y<-eps)
760  : (this->bottom()-pt.y<-eps && pt.y-this->top()<-eps));
761 }
762 
763 
764 template <class T>
765 inline T iwiderPos( int x1, int x2, double f )
766 { return sCast(T,mNINT32(x1 + f * (x1 - x2))); }
767 
768 
769 template <class T>
770 inline T fwiderPos( T x1, T x2, T f )
771 { return x1 + f * (x1 - x2); }
772 
773 
774 template <class T>
775 PixRectangle<T>::PixRectangle( T l , T t, T r, T b )
776  : Rectangle<T>(l,t,r,b)
777 {}
778 
779 
780 template <class T>
782  : Rectangle<T>(tl,br)
783 {}
784 
785 
786 template <class T>
788  : Rectangle<T>(tl,sz)
789 {}
790 
791 
792 template <class T>
794  : Rectangle<T>( r )
795 {}
796 
797 
798 template <class T> inline
799 bool PixRectangle<T>::isInside( const Point2D<T>& p ) const
800 { return !xOutside( p.x ) && !yOutside( p.y ) && !isOnSide( p ); }
801 
802 
803 template <class T> inline
805 { return xOutside(p.x) || yOutside(p.y); }
806 
807 
808 template <class T> inline
809 bool PixRectangle<T>::contains( const Point2D<T>& p ) const
810 { return !isOutside(p); }
811 
812 
813 template <class T> inline
814 bool PixRectangle<T>::contains( const PixRectangle<T>& other ) const
815 {
816  return contains(other.topleft_) && contains(other.bottomright_);
817 }
818 
819 
820 template <class T> inline
821 bool PixRectangle<T>::isInside( const PixRectangle<T>& other ) const
822 {
823  return other.isInside(this->topleft_) && other.isInside(this->bottomright_);
824 }
825 
826 
827 template <class T> inline
829 {
830  f *= .5;
831  return PixRectangle<T>( iwiderPos<T>(this->left(),this->right(),f),
832  iwiderPos<T>(this->top(),this->bottom(),f),
833  iwiderPos<T>(this->right(),this->left(),f),
834  iwiderPos<T>(this->bottom(),this->top(),f) );
835 }
836 
837 
838 template <class T>
840 {
841  f *= .5;
842  return PosRectangle<T>( fwiderPos(this->left(),this->right(),f),
843  fwiderPos(this->top(),this->bottom(),f),
844  fwiderPos(this->right(),this->left(),f),
845  fwiderPos(this->bottom(),this->top(),f) );
846 }
847 
848 
849 template <class T> template <class TT> inline
851 {
852  return PosRectangle<T>( this->topleft_.scale(xx,yy),
853  this->bottomright_.scale(xx,yy) );
854 }
855 
856 
857 template <class T>
858 inline bool Rectangle<T>::operator >( const Rectangle<T>& r ) const
859 {
860  Size2D<T> diff( width()-r.width(), height()-r.height() );
861 
862  if ( diff.width() > 0 && diff.height() > 0 )
863  return true;
864  if ( diff.width() < 0 && diff.height() < 0 )
865  return false;
866 
867  return diff.width() < 0 ? diff.height() < -diff.width()
868  : diff.width() > -diff.height();
869 }
870 
871 
872 template <class T>
873 inline void Rectangle<T>::limitTo( const Rectangle<T>& r )
874 {
875  topleft_ = r.moveInside( topleft_ );
876  bottomright_ = r.moveInside( bottomright_ );
877 }
878 
879 
880 template <class T>
881 inline void Rectangle<T>::translate(const Point2D<T> & trans )
882 {
883  topleft_ += trans;
884  bottomright_ += trans;
885 }
886 
887 
888 template <class T>
889 inline void Rectangle<T>::include( const Rectangle<T>& r )
890 {
891  if ( !r.isDefined() ) return;
892  if ( !isDefined() ) *this = r;
893 
894  if ( revX() )
895  {
896  if ( r.left() > left() ) topleft_.x = r.left();
897  if ( r.right() < right() ) bottomright_.x = r.right();
898  }
899  else
900  {
901  if ( r.left() < left() ) topleft_.x = r.left();
902  if ( r.right() > right() ) bottomright_.x = r.right();
903  }
904  if ( revY() )
905  {
906  if ( r.bottom() > bottom() ) bottomright_.y = r.bottom();
907  if ( r.top() < top() ) topleft_.y = r.top();
908  }
909  else
910  {
911  if ( r.bottom() < bottom() ) bottomright_.y = r.bottom();
912  if ( r.top() > top() ) topleft_.y = r.top();
913  }
914 }
915 
916 
917 template <class T>
918 inline void Rectangle<T>::include( const Point2D<T>& p )
919 {
920  if ( !p.isDefined() ) return;
921  if ( !isDefined() ) topleft_ = bottomright_ = p;
922 
923  if ( revX() )
924  {
925  if ( p.x > left() ) topleft_.x = p.x;
926  if ( p.x < right() ) bottomright_.x = p.x;
927  }
928  else
929  {
930  if ( p.x < left() ) topleft_.x = p.x;
931  if ( p.x > right() ) bottomright_.x = p.x;
932  }
933  if ( revY() )
934  {
935  if ( p.y > bottom() ) bottomright_.y = p.y;
936  if ( p.y < top() ) topleft_.y = p.y;
937  }
938  else
939  {
940  if ( p.y < bottom() ) bottomright_.y = p.y;
941  if ( p.y > top() ) topleft_.y = p.y;
942  }
943 }
944 
945 }; // namespace Geom
946 
Swap
void Swap(T &a, T &b)
Definition: commondefs.h:46
Geom::Point2D::operator[]
T operator[](int idx) const
Definition: geometry.h:305
Geom::PosRectangle::contains
bool contains(const PosRectangle< T > &other, T eps) const
Definition: geometry.h:245
Geom::Size2D::operator!=
bool operator!=(const Size2D< T > &) const
Definition: geometry.h:416
Geom::Point2D::setXY
void setXY(T xx, T yy)
Definition: geometry.h:283
Geom::Rectangle::sortCorners
void sortCorners(bool leftislow=true, bool topislow=true)
Definition: geometry.h:633
Geom::Rectangle::setTopLeft
void setTopLeft(Point2D< T >)
Definition: geometry.h:529
Geom::PixRectangle::xOutside
bool xOutside(T) const
Definition: geometry.h:705
Geom::Rectangle::setBottom
void setBottom(T val)
Definition: geometry.h:618
Geom::PixRectangle::PixRectangle
PixRectangle(T l=0, T t=0, T r=0, T b=0)
Definition: geometry.h:775
Geom::Rectangle::topRight
Point2D< T > topRight() const
Definition: geometry.h:506
Geom::PointF
Point2D< float > PointF
Definition: geometry.h:72
Geom::iwiderPos
T iwiderPos(int x1, int x2, double f)
Definition: geometry.h:765
Geom::Rectangle::bottom
T bottom() const
Definition: geometry.h:598
Geom::Rectangle::translate
void translate(const Point2D< T > &)
Definition: geometry.h:881
Geom::PixRectangle::PixRectangle
PixRectangle(const Point2D< T > &tl, const Size2D< T > &sz)
Definition: geometry.h:787
Geom::Point2D::swapXY
void swapXY()
Definition: geometry.h:369
Geom::Point2D::operator-=
Point2D< T > & operator-=(const Point2D< T > &)
Definition: geometry.h:339
Geom::PixRectangle::contains
bool contains(const Point2D< T > &) const
Definition: geometry.h:809
Geom::PixRectangle::isOutside
bool isOutside(const Point2D< T > &) const
Definition: geometry.h:804
Geom::Point2D::scale
Point2D< T > scale(TT xx, TT yy) const
Definition: geometry.h:400
left
@ left
Definition: i_layout.h:28
mIsUdf
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:289
Geom::Rectangle::setBottomRight
void setBottomRight(Point2D< T >)
Definition: geometry.h:534
Geom::Point2D::udf
static Point2D< T > udf()
Definition: geometry.h:65
Geom::Rectangle::setTopBottom
void setTopBottom(const Interval< T > &)
Definition: geometry.h:549
sCast
#define sCast(tp, v)
Definition: commondefs.h:141
Geom::Point2D::operator-
Point2D< T > operator-(const Point2D< T > &) const
Definition: geometry.h:349
Geom::Rectangle::operator>
bool operator>(const Rectangle< T > &) const
Definition: geometry.h:858
Geom::PixRectangle::isOnSide
bool isOnSide(const Point2D< T > &) const
Definition: geometry.h:721
mMAX
#define mMAX(x, y)
Definition: commondefs.h:61
Geom::Rectangle::isDefined
bool isDefined() const
Definition: geometry.h:651
Geom::Rectangle::setRight
void setRight(T val)
Definition: geometry.h:613
Geom::Rectangle::setTopRight
void setTopRight(Point2D< T >)
Definition: geometry.h:539
Geom::PixRectangle::isInside
bool isInside(const PixRectangle< T > &) const
Definition: geometry.h:821
Geom::Rectangle::setLeft
void setLeft(T val)
Definition: geometry.h:603
Geom::Rectangle::Rectangle
Rectangle(T l=0, T t=0, T r=0, T b=0)
Definition: geometry.h:472
Geom::Rectangle::operator-=
Rectangle< T > & operator-=(const Point2D< T > &)
Definition: geometry.h:661
Geom::Size2D::height_
T height_
Definition: geometry.h:101
Geom::PixRectangle::grownBy
PixRectangle< T > grownBy(double sidesincreasebyfactor=1) const
Definition: geometry.h:828
Geom::Point2D::abs
double abs() const
Definition: geometry.h:376
Geom::Rectangle::bottomRight
Point2D< T > bottomRight() const
Definition: geometry.h:516
Geom::Rectangle::top
T top() const
Definition: geometry.h:588
Geom::Point2D::setFrom
Point2D< T > & setFrom(const Point2D< TT > &)
Definition: geometry.h:279
Geom::Rectangle::centre
Point2D< T > centre() const
Definition: geometry.h:521
Geom::Rectangle::limitTo
void limitTo(const Rectangle< T > &)
Definition: geometry.h:873
Geom::PixRectangle::isInside
bool isInside(const Point2D< T > &) const
Definition: geometry.h:799
Geom::Rectangle::swapHor
void swapHor()
Definition: geometry.h:676
Geom::Rectangle::operator+=
Rectangle< T > & operator+=(const Point2D< T > &)
Definition: geometry.h:656
Geom::Rectangle::right
T right() const
Definition: geometry.h:593
Geom::PosRectangle::isOnSide
bool isOnSide(const Point2D< T > &p, T eps) const
Definition: geometry.h:746
Geom::Size2D::setWidth
void setWidth(T val)
Definition: geometry.h:431
Geom::Rectangle::operator!=
bool operator!=(const Rectangle< T > &) const
Definition: geometry.h:496
Geom::Point2D::zero
Point2D< T > & zero()
Definition: geometry.h:291
Geom::PixRectangle::PixRectangle
PixRectangle(const Point2D< T > &tl, const Point2D< T > &br)
Definition: geometry.h:781
Geom::PosRectangle::isInside
bool isInside(const PosRectangle< T > &other, T eps) const
Definition: geometry.h:250
Geom::Rectangle::include
void include(const Rectangle< T > &)
Definition: geometry.h:889
Geom::Rectangle::zero
void zero()
Definition: geometry.h:646
Geom::Size2D::operator+=
Size2D< T > & operator+=(T val)
Definition: geometry.h:446
Geom::fwiderPos
T fwiderPos(T x1, T x2, T f)
Definition: geometry.h:770
Geom::Point2D::operator/
Point2D< T > operator/(const T den) const
Definition: geometry.h:359
Geom::RectF
PosRectangle< float > RectF
Definition: geometry.h:269
Geom::Rectangle::setBottomLeft
void setBottomLeft(Point2D< T >)
Definition: geometry.h:544
Geom::Rectangle::checkCorners
bool checkCorners(bool leftislow=true, bool topislow=true) const
Definition: geometry.h:623
Geom::Point2D::operator[]
T & operator[](int idx)
Definition: geometry.h:300
Geom::Rectangle::include
void include(const Point2D< T > &)
Definition: geometry.h:918
Geom::Rectangle::left
T left() const
Definition: geometry.h:583
Geom::Rectangle::size
Size2D< T > size() const
Definition: geometry.h:641
Geom::Point2D::isDefined
bool isDefined() const
Definition: geometry.h:364
Geom::PosRectangle::grownBy
PosRectangle< T > grownBy(T sidesincreasebyfactor=1) const
Definition: geometry.h:839
Geom::PosRectangle::yOutside
bool yOutside(T, T) const
Definition: geometry.h:738
Geom::Rectangle::swapVer
void swapVer()
Definition: geometry.h:685
Geom::PosRectangle::PosRectangle
PosRectangle(Point2D< T > tl, Point2D< T > br)
Definition: geometry.h:234
Geom::PosRectangle::PosRectangle
PosRectangle(T l=0, T t=0, T r=0, T b=0)
Definition: geometry.h:232
Geom::PosRectangle
Floating-point rectangle class.
Definition: geometry.h:230
mClass
#define mClass(module)
Definition: commondefs.h:181
Geom::RectD
PosRectangle< double > RectD
Definition: geometry.h:270
Geom::Point2D::distTo
double distTo(const Point2D< T > &) const
Definition: geometry.h:386
Geom::Rectangle::bottomright_
Point2D< T > bottomright_
Definition: geometry.h:182
Geom::PixRectangle::PixRectangle
PixRectangle(const Rectangle< T > &)
Definition: geometry.h:793
Geom::Point2D::operator!=
bool operator!=(const Point2D< T > &) const
Definition: geometry.h:315
Geom::Point2D::operator-
Point2D< T > operator-()
Definition: geometry.h:295
Geom::Size2D::width_
T width_
Definition: geometry.h:100
Geom::Point2D::operator==
bool operator==(const Point2D< T > &) const
Definition: geometry.h:310
gendefs.h
Geom::Rectangle::Rectangle
Rectangle(const Point2D< T > &tl, const Point2D< T > &br)
Definition: geometry.h:479
Geom::Point2D::sqDistTo
T sqDistTo(const Point2D< T > &) const
Definition: geometry.h:391
Geom::Rectangle::revY
bool revY() const
Definition: geometry.h:699
Geom::Point2D::operator/=
Point2D< T > & operator/=(T den)
Definition: geometry.h:329
Geom::PixRectangle::contains
bool contains(const PixRectangle< T > &) const
Definition: geometry.h:814
Geom::PointI
Point2D< int > PointI
Definition: geometry.h:71
Geom::Size2D::operator-=
Size2D< T > & operator-=(const Size2D< T > &)
Definition: geometry.h:461
Geom::Point2D::operator+=
Point2D< T > & operator+=(const Point2D< T > &)
Definition: geometry.h:334
Geom::RectI
PosRectangle< int > RectI
Definition: geometry.h:268
Geom::PosRectangle::xOutside
bool xOutside(T, T) const
Definition: geometry.h:730
Geom::Rectangle::setLeftRight
void setLeftRight(const Interval< T > &)
Definition: geometry.h:554
Geom::Point2D::operator+=
Point2D< T > & operator+=(T dist)
Definition: geometry.h:319
Geom::PosRectangle::contains
bool contains(const Point2D< T > &p, T eps) const
Definition: geometry.h:242
Geom::PixRectangle
Integer rectangle class.
Definition: geometry.h:197
Geom::Size2D::Size2D
Size2D(T w=0, T h=0)
Definition: geometry.h:406
right
@ right
Definition: i_layout.h:28
Geom::Rectangle::topLeft
Point2D< T > topLeft() const
Definition: geometry.h:501
Geom::Point2D::operator+
Point2D< T > operator+(const Point2D< T > &) const
Definition: geometry.h:344
Geom::Point2D::sqAbs
T sqAbs() const
Definition: geometry.h:381
Geom::PointD
Point2D< double > PointD
Definition: geometry.h:73
Geom::Rectangle::width
T width() const
Definition: geometry.h:573
Geom::Size2D::operator-=
Size2D< T > & operator-=(T val)
Definition: geometry.h:451
Geom::Size2D::width
T width() const
Definition: geometry.h:421
Geom::Rectangle::revX
bool revX() const
Definition: geometry.h:694
Geom::PixRectangle::yOutside
bool yOutside(T) const
Definition: geometry.h:713
Geom::PosRectangle::scale
PosRectangle< T > scale(TT xx, TT yy) const
Definition: geometry.h:850
Geom
Definition: geometry.h:19
Geom::Point2D
Basic point class.
Definition: geometry.h:27
mMIN
#define mMIN(x, y)
Definition: commondefs.h:62
Geom::Rectangle::Rectangle
Rectangle(const Point2D< T > &tl, const Size2D< T > &sz)
Definition: geometry.h:485
Geom::Size2D::operator+=
Size2D< T > & operator+=(const Size2D< T > &)
Definition: geometry.h:456
Geom::Point2D::y
T y
Definition: geometry.h:68
Geom::Size2D::operator==
bool operator==(const Size2D< T > &) const
Definition: geometry.h:411
Geom::Point2D::setXY
void setXY(TT xx, TT yy)
Definition: geometry.h:287
Geom::Rectangle::bottomLeft
Point2D< T > bottomLeft() const
Definition: geometry.h:511
Geom::Point2D::x
T x
Definition: geometry.h:67
Geom::Size2D
Basic 2D sizes (width/height) class.
Definition: geometry.h:81
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
Geom::Rectangle::height
T height() const
Definition: geometry.h:578
operator>
bool operator>(const ObjectWithName &obj1, const ObjectWithName &obj2)
Definition: namedobj.h:95
Geom::Size2D::operator+
Size2D< T > operator+(T val) const
Definition: geometry.h:441
Geom::Rectangle::operator+=
Rectangle< T > & operator+=(const Size2D< T > &)
Definition: geometry.h:666
Geom::Rectangle::moveInside
Point2D< T > moveInside(const Point2D< T > &) const
Definition: geometry.h:559
Geom::Point2D::Point2D
Point2D(T xx=0, T yy=0)
Definition: geometry.h:274
Geom::Point2D::operator*
Point2D< T > operator*(const T factor) const
Definition: geometry.h:354
Geom::Rectangle::operator-=
Rectangle< T > & operator-=(const Size2D< T > &)
Definition: geometry.h:671
Geom::Size2D::setHeight
void setHeight(T val)
Definition: geometry.h:436
Geom::Rectangle
Basic 2D rectangle class.
Definition: geometry.h:118
ranges.h
Geom::Rectangle::operator==
bool operator==(const Rectangle< T > &) const
Definition: geometry.h:491
Math::Sqrt
float Sqrt(float)
Interval
Interval of values.
Definition: commontypes.h:30
Geom::Rectangle::topleft_
Point2D< T > topleft_
Definition: geometry.h:181
Geom::PosRectangle::isOutside
bool isOutside(const Point2D< T > &p, T eps) const
Definition: geometry.h:237
Geom::Point2D::operator*=
Point2D< T > & operator*=(T factor)
Definition: geometry.h:324
mNINT32
#define mNINT32(x)
Definition: commondefs.h:58
math2.h
Geom::PosRectangle::isInside
bool isInside(const Point2D< T > &, T eps) const
Definition: geometry.h:755
Geom::Size2D::height
T height() const
Definition: geometry.h:426
Geom::Rectangle::setTop
void setTop(T val)
Definition: geometry.h:608

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021