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

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