PCL
Rectangle.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.8.5
6 // ----------------------------------------------------------------------------
7 // pcl/Rectangle.h - Released 2024-12-28T16:53:48Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2024 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_Rectangle_h
53 #define __PCL_Rectangle_h
54 
56 
57 #include <pcl/Defs.h>
58 
59 #include <pcl/Flags.h>
60 #include <pcl/Math.h>
61 #include <pcl/Point.h>
62 #include <pcl/Relational.h>
63 
64 #ifdef __PCL_QT_INTERFACE
65 # include <QtCore/QRect>
66 # ifndef __PCL_QT_NO_RECT_DRAWING_HELPERS
67 # include <QtGui/QPainter>
68 # include <QtGui/QBrush>
69 # endif
70 #endif
71 
72 namespace pcl
73 {
74 
75 // ----------------------------------------------------------------------------
76 
91 namespace Clip
92 {
93  enum mask_type
94  {
95  Inside = 0x00, // Unclipped: inside the clipping rectangle
96  Left = 0x01, // Clipped at the left side
97  Top = 0x02, // Clipped at the top side
98  Right = 0x04, // Clipped at the right side
99  Bottom = 0x08 // Clipped at the bottom side
100  };
101 }
102 
107 
108 // ----------------------------------------------------------------------------
109 
125 template <typename T> inline
126 bool IsPoint( T x0, T y0, T x1, T y1 ) noexcept
127 {
128  return x0 == x1 && y0 == y1;
129 }
130 
143 template <typename T> inline
144 bool IsLine( T x0, T y0, T x1, T y1 ) noexcept
145 {
146  return ((x0 == x1) ^ (y0 == y1)) != 0;
147 }
148 
160 template <typename T> inline
161 bool IsHorizontalLine( T x0, T y0, T x1, T y1 ) noexcept
162 {
163  return y0 == y1 && x0 != x1;
164 }
165 
177 template <typename T> inline
178 bool IsVerticalLine( T x0, T y0, T x1, T y1 ) noexcept
179 {
180  return x0 == x1 && y0 != y1;
181 }
182 
194 template <typename T> inline
195 bool IsPointOrLine( T x0, T y0, T x1, T y1 ) noexcept
196 {
197  return x0 == x1 || y0 == y1;
198 }
199 
211 template <typename T> inline
212 bool IsRect( T x0, T y0, T x1, T y1 ) noexcept
213 {
214  return x0 != x1 && y0 != y1;
215 }
216 
227 template <typename T> inline
228 bool IsNormalRect( T x0, T y0, T x1, T y1 ) noexcept
229 {
230  return x0 < x1 && y0 < y1;
231 }
232 
244 template <typename T> inline
245 bool IsOrderedRect( T x0, T y0, T x1, T y1 ) noexcept
246 {
247  return x0 <= x1 && y0 <= y1;
248 }
249 
261 template <typename T> inline
262 void OrderRect( T& x0, T& y0, T& x1, T& y1 ) noexcept
263 {
264  if ( x1 < x0 )
265  pcl::Swap( x0, x1 );
266  if ( y1 < y0 )
267  pcl::Swap( y0, y1 );
268 }
269 
270 // ----------------------------------------------------------------------------
271 
272 /*
273  * ### NB: Template class GenericRectangle cannot have virtual member
274  * functions. This is because internal PCL and core routines rely on
275  * GenericRectangle<int>, GenericRectangle<float> and
276  * GenericRectangle<double> to be directly castable to int*, float* and
277  * double*, respectively. See also the PCL_ASSERT_RECT_SIZE() macro.
278  */
279 
280 #define PCL_ASSERT_RECT_SIZE() \
281  static_assert( sizeof( *this ) == 4*sizeof( T ), "Invalid sizeof( GenericRectangle<> )" )
282 
314 template <typename T>
315 class PCL_CLASS GenericRectangle
316 {
317 public:
318 
322  using component = T;
323 
328 
329  /*
330  * Rectangle coordinates: x0=left, y0=top, x1=right, y1=bottom.
331  * The x1 (right) and y1 (bottom) coordinates are excluded from the
332  * rectangular area, so we always have: width=x1-x0 and height=y1-y0.
333  */
338 
343  constexpr GenericRectangle()
344  {
345  PCL_ASSERT_RECT_SIZE();
346  }
347 
358  template <typename T1>
359  constexpr GenericRectangle( T1 left, T1 top, T1 right, T1 bottom )
360  : x0( component( left ) )
361  , y0( component( top ) )
362  , x1( component( right ) )
363  , y1( component( bottom ) )
364  {
365  PCL_ASSERT_RECT_SIZE();
366  }
367 
393  template <typename T1>
394  GenericRectangle( std::initializer_list<T1> l )
395  {
396  PCL_ASSERT_RECT_SIZE();
397  switch ( l.size() )
398  {
399  default:
400  case 4: y1 = component( l.begin()[3] );
401  case 3: x1 = component( l.begin()[2] );
402  case 2: y0 = component( l.begin()[1] );
403  case 1: x0 = component( l.begin()[0] );
404  case 0: break;
405  }
406  switch ( l.size() )
407  {
408  case 0: x0 = component( 0 );
409  case 1: y0 = component( 0 );
410  case 2: x1 = component( 0 );
411  case 3: y1 = component( 0 );
412  default:
413  case 4: break;
414  }
415  }
416 
426  template <typename T1>
427  GenericRectangle( const pcl::GenericPoint<T1>& leftTop, const pcl::GenericPoint<T1>& rightBottom )
428  : GenericRectangle( component( leftTop.x ), component( leftTop.y ),
429  component( rightBottom.x ), component( rightBottom.y ) )
430  {
431  PCL_ASSERT_RECT_SIZE();
432  }
433 
442  constexpr GenericRectangle( component width, component height )
443  : GenericRectangle( component( 0 ), component( 0 ), width, height )
444  {
445  PCL_ASSERT_RECT_SIZE();
446  }
447 
456  : GenericRectangle( d, d, d, d )
457  {
458  PCL_ASSERT_RECT_SIZE();
459  }
460 
465  template <typename T1>
467  : GenericRectangle( component( r.x0 ), component( r.y0 ),
468  component( r.x1 ), component( r.y1 ) )
469  {
470  PCL_ASSERT_RECT_SIZE();
471  }
472 
473 #ifdef __PCL_QT_INTERFACE
474  GenericRectangle( const QRect& r )
475  : GenericRectangle( component( r.left() ), component( r.top() ),
476  component( r.right()+1 ), component( r.bottom()+1 ) )
477  {
478  PCL_ASSERT_RECT_SIZE();
479  }
480 
481  GenericRectangle( const QPoint& p0, const QPoint& p1 )
482  : GenericRectangle( component( p0.x() ), component( p0.y() ),
483  component( p1.x() ), component( p1.y() ) )
484  {
485  PCL_ASSERT_RECT_SIZE();
486  }
487 #endif
488 
493  component Left() const noexcept
494  {
495  return x0;
496  }
497 
502  component Top() const noexcept
503  {
504  return y0;
505  }
506 
511  component Right() const noexcept
512  {
513  return x1;
514  }
515 
520  component Bottom() const noexcept
521  {
522  return y1;
523  }
524 
529  point LeftTop() const noexcept
530  {
531  return point( pcl::Min( x0, x1 ), pcl::Min( y0, y1 ) );
532  }
533 
537  point TopLeft() const noexcept
538  {
539  return LeftTop();
540  }
541 
546  point RightTop() const noexcept
547  {
548  return point( pcl::Max( x0, x1 ), pcl::Min( y0, y1 ) );
549  }
550 
554  point TopRight() const noexcept
555  {
556  return RightTop();
557  }
558 
563  point LeftBottom() const noexcept
564  {
565  return point( pcl::Min( x0, x1 ), pcl::Max( y0, y1 ) );
566  }
567 
571  point BottomLeft() const noexcept
572  {
573  return LeftBottom();
574  }
575 
580  point RightBottom() const noexcept
581  {
582  return point( pcl::Max( x0, x1 ), pcl::Max( y0, y1 ) );
583  }
584 
588  point BottomRight() const noexcept
589  {
590  return RightBottom();
591  }
592 
596  point Center() const noexcept
597  {
598  return point( (x0 + x1)/2, (y0 + y1)/2 );
599  }
600 
604  point CenterTop() const noexcept
605  {
606  return point( (x0 + x1)/2, pcl::Min( y0, y1 ) );
607  }
608 
612  point CenterBottom() const noexcept
613  {
614  return point( (x0 + x1)/2, pcl::Min( y0, y1 ) );
615  }
616 
620  point CenterLeft() const noexcept
621  {
622  return point( pcl::Min( x0, x1 ), (y0 + y1)/2 );
623  }
624 
628  point CenterRight() const noexcept
629  {
630  return point( pcl::Min( x0, x1 ), (y0 + y1)/2 );
631  }
632 
637  component Width() const noexcept
638  {
639  return pcl::Abs( x1 - x0 );
640  }
641 
646  component Height() const noexcept
647  {
648  return pcl::Abs( y1 - y0 );
649  }
650 
655  component Perimeter() const noexcept
656  {
657  component w = Width(), h = Height();
658  return w+w+h+h;
659  }
660 
667  component ManhattanDistance() const noexcept
668  {
669  return Width() + Height();
670  }
671 
676  component Area() const noexcept
677  {
678  return pcl::Abs( (x1 - x0)*(y1 - y0) );
679  }
680 
685  double CenterX() const noexcept
686  {
687  return 0.5*(x0 + x1);
688  }
689 
694  double CenterY() const noexcept
695  {
696  return 0.5*(y0 + y1);
697  }
698 
705  double Hypot() const noexcept
706  {
707  double w = x1 - x0, h = y1 - y0;
708  return w*w + h*h;
709  }
710 
715  double Diagonal() const noexcept
716  {
717  return pcl::Sqrt( Hypot() );
718  }
719 
723  bool IsPoint() const noexcept
724  {
725  return pcl::IsPoint( x0, y0, x1, y1 );
726  }
727 
731  bool IsLine() const noexcept
732  {
733  return pcl::IsLine( x0, y0, x1, y1 );
734  }
735 
739  bool IsHorizontalLine() const noexcept
740  {
741  return pcl::IsHorizontalLine( x0, y0, x1, y1 );
742  }
743 
747  bool IsVerticalLine() const noexcept
748  {
749  return pcl::IsVerticalLine( x0, y0, x1, y1 );
750  }
751 
755  bool IsPointOrLine() const noexcept
756  {
757  return pcl::IsPointOrLine( x0, y0, x1, y1 );
758  }
759 
764  bool IsRect() const noexcept
765  {
766  return pcl::IsRect( x0, y0, x1, y1 );
767  }
768 
772  bool IsNormal() const noexcept
773  {
774  return pcl::IsNormalRect( x0, y0, x1, y1 );
775  }
776 
780  bool IsOrdered() const noexcept
781  {
782  return pcl::IsOrderedRect( x0, y0, x1, y1 );
783  }
784 
788  void Order() noexcept
789  {
790  pcl::OrderRect( x0, y0, x1, y1 );
791  }
792 
796  GenericRectangle Ordered() const noexcept
797  {
798  GenericRectangle r = *this;
799  r.Order();
800  return r;
801  }
802 
813  template <typename T1>
814  ClipFlags ClipCode( T1 x, T1 y ) const noexcept
815  {
816  ClipFlags clip; // defaults to zero = Clip::Inside
817 
818  if ( x0 <= x1 )
819  {
820  if ( x < x0 ) clip |= Clip::Left;
821  if ( x > x1 ) clip |= Clip::Right;
822  }
823  else
824  {
825  if ( x < x1 ) clip |= Clip::Left;
826  if ( x > x0 ) clip |= Clip::Right;
827  }
828 
829  if ( y0 <= y1 )
830  {
831  if ( y < y0 ) clip |= Clip::Top;
832  if ( y > y1 ) clip |= Clip::Bottom;
833  }
834  else
835  {
836  if ( y < y1 ) clip |= Clip::Top;
837  if ( y > y0 ) clip |= Clip::Bottom;
838  }
839 
840  return clip;
841  }
842 
852  template <typename T1>
853  ClipFlags ClipCode( const pcl::GenericPoint<T1>& p ) const noexcept
854  {
855  return ClipCode( p.x, p.y );
856  }
857 
872  template <typename T1>
873  ClipFlags ClipCodeFast( T1 x, T1 y ) const noexcept
874  {
875  ClipFlags clip; // defaults to zero = Clip::Inside
876  if ( x < x0 ) clip |= Clip::Left;
877  if ( x > x1 ) clip |= Clip::Right;
878  if ( y < y0 ) clip |= Clip::Top;
879  if ( y > y1 ) clip |= Clip::Bottom;
880  return clip;
881  }
882 
896  template <typename T1>
897  ClipFlags ClipCodeFast( const pcl::GenericPoint<T1>& p ) const noexcept
898  {
899  return ClipCodeFast( p.x, p.y );
900  }
901 
918  template <typename T1>
919  bool ClipLine( T1& lx0, T1& ly0, T1& lx1, T1& ly1 ) const noexcept
920  {
921  T x0_ = pcl::Min( x0, x1 );
922  T y0_ = pcl::Min( y0, y1 );
923  T x1_ = pcl::Max( x0, x1 );
924  T y1_ = pcl::Max( y0, y1 );
925  ClipFlags clip0 = ClipCode( lx0, ly0 );
926  ClipFlags clip1 = ClipCode( lx1, ly1 );
927  for ( ;; )
928  {
929  if ( !(clip0 | clip1) ) // both endpoints inside
930  return true;
931  if ( clip0 & clip1 ) // both endpoints at the same side
932  return false;
933 
934  // Only one endpoint outside
935  ClipFlags clipOut = clip0 ? clip0 : clip1;
936  T1 x, y;
937  if ( clipOut & Clip::Left )
938  {
939  x = x0_;
940  y = ly1 - (lx1 - x0_) * (ly1 - ly0)/(lx1 - lx0);
941  }
942  else if ( clipOut & Clip::Top )
943  {
944  x = lx0 - (ly0 - y0_) * (lx1 - lx0)/(ly1 - ly0);
945  y = y0_;
946  }
947  else if ( clipOut & Clip::Right )
948  {
949  x = x1_;
950  y = ly0 - (lx0 - x1_) * (ly1 - ly0)/(lx1 - lx0);
951  }
952  else // if ( clipOut & Clip::Bottom )
953  {
954  x = lx1 - (ly1 - y1_) * (lx1 - lx0)/(ly1 - ly0);
955  y = y1_;
956  }
957 
958  if ( clipOut == clip0 )
959  {
960  lx0 = x;
961  ly0 = y;
962  clip0 = ClipCode( lx0, ly0 );
963  }
964  else
965  {
966  lx1 = x;
967  ly1 = y;
968  clip1 = ClipCode( lx1, ly1 );
969  }
970  }
971  }
972 
982  template <typename T1>
983  bool ClipLine( pcl::GenericPoint<T1>& p0, pcl::GenericPoint<T1>& p1 ) const noexcept
984  {
985  return ClipLine( p0.x, p0.y, p1.x, p1.y );
986  }
987 
1008  template <typename T1>
1009  bool ClipLineFast( T1& lx0, T1& ly0, T1& lx1, T1& ly1 ) const noexcept
1010  {
1011  ClipFlags clip0 = ClipCodeFast( lx0, ly0 );
1012  ClipFlags clip1 = ClipCodeFast( lx1, ly1 );
1013  for ( ;; )
1014  {
1015  if ( !(clip0 | clip1) ) // both endpoints inside
1016  return true;
1017  if ( clip0 & clip1 ) // both endpoints at the same side
1018  return false;
1019 
1020  // Only one endpoint outside
1021  ClipFlags clipOut = clip0 ? clip0 : clip1;
1022  T1 x, y;
1023  if ( clipOut & Clip::Left )
1024  {
1025  x = x0;
1026  y = ly1 - (lx1 - x0) * (ly1 - ly0)/(lx1 - lx0);
1027  }
1028  else if ( clipOut & Clip::Top )
1029  {
1030  x = lx0 - (ly0 - y0) * (lx1 - lx0)/(ly1 - ly0);
1031  y = y0;
1032  }
1033  else if ( clipOut & Clip::Right )
1034  {
1035  x = x1;
1036  y = ly0 - (lx0 - x1) * (ly1 - ly0)/(lx1 - lx0);
1037  }
1038  else // if ( clipOut & Clip::Bottom )
1039  {
1040  x = lx1 - (ly1 - y1) * (lx1 - lx0)/(ly1 - ly0);
1041  y = y1;
1042  }
1043 
1044  if ( clipOut == clip0 )
1045  {
1046  lx0 = x;
1047  ly0 = y;
1048  clip0 = ClipCodeFast( lx0, ly0 );
1049  }
1050  else
1051  {
1052  lx1 = x;
1053  ly1 = y;
1054  clip1 = ClipCodeFast( lx1, ly1 );
1055  }
1056  }
1057  }
1058 
1072  template <typename T1>
1074  {
1075  return ClipLineFast( p0.x, p0.y, p1.x, p1.y );
1076  }
1077 
1082  template <typename T1>
1083  bool Includes( T1 x, T1 y ) const noexcept
1084  {
1085  return ((x0 < x1) ? (x >= x0 && x <= x1) : (x >= x1 && x <= x0)) &&
1086  ((y0 < y1) ? (y >= y0 && y <= y1) : (y >= y1 && y <= y0));
1087  }
1088 
1092  template <typename T1>
1093  bool Includes( const pcl::GenericPoint<T1>& p ) const noexcept
1094  {
1095  return Includes( p.x, p.y );
1096  }
1097 
1101  template <typename T1>
1102  bool Includes( const GenericRectangle<T1>& r ) const noexcept
1103  {
1104  return Includes( r.x0, r.y0 ) && Includes( r.x1, r.y1 );
1105  }
1106 
1107 #ifdef __PCL_QT_INTERFACE
1108  bool Includes( const QPoint& p ) const noexcept
1109  {
1110  return Includes( p.x(), p.y() );
1111  }
1112 
1113  bool Includes( const QRect& r ) const noexcept
1114  {
1115  return Includes( r.left(), r.top() ) && Includes( r.right()+1, r.bottom()+1 );
1116  }
1117 #endif
1118 
1127  template <typename T1>
1128  bool IncludesFast( T1 x, T1 y ) const noexcept
1129  {
1130  return x >= x0 && y >= y0 && x <= x1 && y <= y1;
1131  }
1132 
1140  template <typename T1>
1141  bool IncludesFast( const pcl::GenericPoint<T1>& p ) const noexcept
1142  {
1143  return IncludesFast( p.x, p.y );
1144  }
1145 
1156  template <typename T1>
1157  bool Intersects( T1 left, T1 top, T1 right, T1 bottom ) const noexcept
1158  {
1159  OrderRect( left, top, right, bottom );
1160  return ((x0 < x1) ? (right >= x0 && left <= x1) : (right >= x1 && left <= x0)) &&
1161  ((y0 < y1) ? (bottom >= y0 && top <= y1) : (bottom >= y1 && top <= y0));
1162  }
1163 
1167  template <typename T1>
1168  bool Intersects( const pcl::GenericRectangle<T1>& r ) const noexcept
1169  {
1170  return Intersects( r.x0, r.y0, r.x1, r.y1 );
1171  }
1172 
1173 #ifdef __PCL_QT_INTERFACE
1174  bool Intersects( const QRect& r ) const noexcept
1175  {
1176  return Intersects( r.left(), r.top(), r.right()+1, r.bottom()+1 );
1177  }
1178 #endif
1179 
1199  template <typename T1>
1200  bool IntersectsFast( T1 left, T1 top, T1 right, T1 bottom ) const noexcept
1201  {
1202  return right >= x0 && left <= x1 && bottom >= y0 && top <= y1;
1203  }
1204 
1211  template <typename T1>
1212  bool IntersectsFast( const pcl::GenericRectangle<T1>& r ) const noexcept
1213  {
1214  return IntersectsFast( r.x0, r.y0, r.x1, r.y1 );
1215  }
1216 
1221  template <typename T1>
1222  void Unite( const GenericRectangle<T1>& r ) noexcept
1223  {
1224  Unite( r.x0, r.y0, r.x1, r.y1 );
1225  }
1226 
1237  template <typename T1>
1238  void Unite( T1 left, T1 top, T1 right, T1 bottom ) noexcept
1239  {
1240  if ( right < left )
1241  Swap( left, right );
1242  if ( bottom < top )
1243  Swap( top, bottom );
1244 
1245  if ( x0 <= x1 )
1246  {
1247  x0 = pcl::Min( x0, component( left ) );
1248  x1 = pcl::Max( x1, component( right ) );
1249  }
1250  else
1251  {
1252  x0 = pcl::Max( x0, component( right ) );
1253  x1 = pcl::Min( x1, component( left ) );
1254  }
1255 
1256  if ( y0 <= y1 )
1257  {
1258  y0 = pcl::Min( y0, component( top ) );
1259  y1 = pcl::Max( y1, component( bottom ) );
1260  }
1261  else
1262  {
1263  y0 = pcl::Max( y0, component( bottom ) );
1264  y1 = pcl::Min( y1, component( top ) );
1265  }
1266  }
1267 
1275  template <typename T1>
1276  void UniteFast( const GenericRectangle<T1>& r ) noexcept
1277  {
1278  UniteFast( r.x0, r.y0, r.x1, r.y1 );
1279  }
1280 
1300  template <typename T1>
1301  void UniteFast( T1 left, T1 top, T1 right, T1 bottom ) noexcept
1302  {
1303  x0 = pcl::Min( x0, component( left ) );
1304  y0 = pcl::Min( y0, component( top ) );
1305  x1 = pcl::Max( x1, component( right ) );
1306  y1 = pcl::Max( y1, component( bottom ) );
1307  }
1308 
1312  template <typename T1>
1313  GenericRectangle Union( const GenericRectangle<T1>& r ) const noexcept
1314  {
1315  GenericRectangle r1 = *this;
1316  r1.Unite( r );
1317  return r1;
1318  }
1319 
1326  template <typename T1>
1328  {
1329  GenericRectangle r1 = *this;
1330  r1.UniteFast( r );
1331  return r1;
1332  }
1333 
1338  template <typename T1>
1339  GenericRectangle& operator |=( const GenericRectangle<T1>& r ) noexcept
1340  {
1341  Unite( r );
1342  return *this;
1343  }
1344 
1345 #ifdef __PCL_QT_INTERFACE
1346  void Unite( const QRect& r )
1347  {
1348  Unite( r.left(), r.top(), r.right()+1, r.bottom()+1 );
1349  }
1350 
1351  GenericRectangle Union( const QRect& r ) const noexcept
1352  {
1353  GenericRectangle r1 = *this;
1354  r1.Unite( r );
1355  return r1;
1356  }
1357 
1358  GenericRectangle& operator |=( const QRect& r ) noexcept
1359  {
1360  Unite( r );
1361  return *this;
1362  }
1363 #endif
1364 
1373  template <typename T1>
1374  bool Intersect( const GenericRectangle<T1>& r ) noexcept
1375  {
1376  return Intersect( r.x0, r.y0, r.x1, r.y1 );
1377  }
1378 
1393  template <typename T1>
1394  bool Intersect( T1 left, T1 top, T1 right, T1 bottom ) noexcept
1395  {
1396  if ( right < left )
1397  Swap( left, right );
1398  if ( bottom < top )
1399  Swap( top, bottom );
1400 
1401  if ( x0 <= x1 )
1402  {
1403  x0 = pcl::Max( x0, component( left ) );
1404  x1 = pcl::Min( x1, component( right ) );
1405  }
1406  else
1407  {
1408  x0 = pcl::Min( x0, component( right ) );
1409  x1 = pcl::Max( x1, component( left ) );
1410  }
1411 
1412  if ( y0 <= y1 )
1413  {
1414  y0 = pcl::Max( y0, component( top ) );
1415  y1 = pcl::Min( y1, component( bottom ) );
1416  }
1417  else
1418  {
1419  y0 = pcl::Min( y0, component( bottom ) );
1420  y1 = pcl::Max( y1, component( top ) );
1421  }
1422 
1423  return IsRect();
1424  }
1425 
1437  template <typename T1>
1438  bool IntersectFast( const GenericRectangle<T1>& r ) noexcept
1439  {
1440  return IntersectFast( r.x0, r.y0, r.x1, r.y1 );
1441  }
1442 
1466  template <typename T1>
1467  bool IntersectFast( T1 left, T1 top, T1 right, T1 bottom ) noexcept
1468  {
1469  x0 = pcl::Max( x0, component( left ) );
1470  y0 = pcl::Max( y0, component( top ) );
1471  x1 = pcl::Min( x1, component( right ) );
1472  y1 = pcl::Min( y1, component( bottom ) );
1473  return IsRect();
1474  }
1475 
1480  template <typename T1>
1482  {
1483  GenericRectangle r1 = *this;
1484  (void)r1.Intersect( r );
1485  return r1;
1486  }
1487 
1495  template <typename T1>
1497  {
1498  GenericRectangle r1 = *this;
1499  (void)r1.IntersectFast( r );
1500  return r1;
1501  }
1502 
1507  template <typename T1>
1508  GenericRectangle& operator &=( const GenericRectangle<T1>& r ) noexcept
1509  {
1510  Intersect( r );
1511  return *this;
1512  }
1513 
1514 #ifdef __PCL_QT_INTERFACE
1515  bool Intersect( const QRect& r ) noexcept
1516  {
1517  return Intersect( r.left(), r.top(), r.right()+1, r.bottom()+1 );
1518  }
1519 
1520  GenericRectangle Intersection( const QRect& r ) const noexcept
1521  {
1522  GenericRectangle r1 = *this;
1523  (void)r1.Intersect( r );
1524  return r1;
1525  }
1526 
1527  GenericRectangle& operator &=( const QRect& r ) noexcept
1528  {
1529  Intersect( r );
1530  return *this;
1531  }
1532 #endif
1533 
1540  template <typename T1>
1541  void Set( T1 left, T1 top, T1 right, T1 bottom ) noexcept
1542  {
1543  x0 = component( left );
1544  y0 = component( top );
1545  x1 = component( right );
1546  y1 = component( bottom );
1547  }
1548 
1556  template <typename T1>
1557  void MoveTo( const pcl::GenericPoint<T1>& p ) noexcept
1558  {
1559  MoveTo( p.x, p.y );
1560  }
1561 
1569  template <typename T1>
1570  void MoveTo( T1 x, T1 y ) noexcept
1571  {
1572  component dx = x1 - x0, dy = y1 - y0;
1573  x0 = component( x );
1574  y0 = component( y );
1575  x1 = x0 + dx;
1576  y1 = y0 + dy;
1577  }
1578 
1579 #ifdef __PCL_QT_INTERFACE
1580  void MoveTo( const QPoint& p ) noexcept
1581  {
1582  MoveTo( p.x(), p.y() );
1583  }
1584 #endif
1585 
1592  template <typename T1>
1594  {
1595  GenericRectangle r( *this );
1596  r.MoveTo( p );
1597  return r;
1598  }
1599 
1606  template <typename T1>
1607  GenericRectangle MovedTo( T1 x, T1 y ) const noexcept
1608  {
1609  GenericRectangle r( *this );
1610  r.MoveTo( x, y );
1611  return r;
1612  }
1613 
1618  template <typename T1>
1619  void MoveBy( const pcl::GenericPoint<T1>& d ) noexcept
1620  {
1621  MoveBy( d.x, d.y );
1622  }
1623 
1629  template <typename T1>
1630  void MoveBy( T1 dx, T1 dy ) noexcept
1631  {
1632  x0 += component( dx );
1633  y0 += component( dy );
1634  x1 += component( dx );
1635  y1 += component( dy );
1636  }
1637 
1647  template <typename T1>
1648  void MoveBy( T1 dxy ) noexcept
1649  {
1650  x0 += component( dxy );
1651  y0 += component( dxy );
1652  x1 += component( dxy );
1653  y1 += component( dxy );
1654  }
1655 
1656 #ifdef __PCL_QT_INTERFACE
1657  void MoveBy( const QPoint& p ) noexcept
1658  {
1659  MoveBy( p.x(), p.y() );
1660  }
1661 #endif
1662 
1669  template <typename T1>
1671  {
1672  GenericRectangle r( *this );
1673  r.MoveBy( d );
1674  return r;
1675  }
1676 
1683  template <typename T1>
1684  GenericRectangle MovedBy( T1 dx, T1 dy ) const noexcept
1685  {
1686  GenericRectangle r( *this );
1687  r.MoveBy( dx, dy );
1688  return r;
1689  }
1690 
1701  template <typename T1>
1702  void ResizeTo( T1 w, T1 h ) noexcept
1703  {
1704  if ( x0 <= x1 )
1705  x1 = x0 + component( w );
1706  else
1707  x0 = x1 + component( w );
1708 
1709  if ( y0 <= y1 )
1710  y1 = y0 + component( h );
1711  else
1712  y0 = y1 + component( h );
1713  }
1714 
1721  template <typename T1>
1722  GenericRectangle ResizedTo( T1 w, T1 h ) const noexcept
1723  {
1724  GenericRectangle r( *this );
1725  r.ResizeTo( w, h );
1726  return r;
1727  }
1728 
1740  template <typename T1>
1741  void ResizeBy( T1 dw, T1 dh ) noexcept
1742  {
1743  if ( x0 <= x1 )
1744  x1 += component( dw );
1745  else
1746  x0 += component( dw );
1747 
1748  if ( y0 <= y1 )
1749  y1 += component( dh );
1750  else
1751  y0 += component( dh );
1752  }
1753 
1760  template <typename T1>
1761  GenericRectangle ResizedBy( T1 dw, T1 dh ) const noexcept
1762  {
1763  GenericRectangle r( *this );
1764  r.ResizeBy( dw, dh );
1765  return r;
1766  }
1767 
1776  template <typename T1>
1777  void SetWidth( T1 w ) noexcept
1778  {
1779  if ( x0 <= x1 )
1780  x1 = x0 + component( w );
1781  else
1782  x0 = x1 + component( w );
1783  }
1784 
1793  template <typename T1>
1794  void SetHeight( T1 h ) noexcept
1795  {
1796  if ( y0 <= y1 )
1797  y1 = y0 + component( h );
1798  else
1799  y0 = y1 + component( h );
1800  }
1801 
1807  template <typename T1>
1808  void InflateBy( T1 dx, T1 dy ) noexcept
1809  {
1810  if ( x1 < x0 )
1811  dx = -dx;
1812  if ( y1 < y0 )
1813  dy = -dy;
1814  x0 -= dx;
1815  y0 -= dy;
1816  x1 += dx;
1817  y1 += dy;
1818  }
1819 
1825  template <typename T1>
1826  void InflateBy( T1 d ) noexcept
1827  {
1828  if ( x0 <= x1 )
1829  x0 -= d, x1 += d;
1830  else
1831  x0 += d, x1 -= d;
1832 
1833  if ( y0 <= y1 )
1834  y0 -= d, y1 += d;
1835  else
1836  y0 += d, y1 -= d;
1837  }
1838 
1843  template <typename T1>
1844  GenericRectangle InflatedBy( T1 dx, T1 dy ) const noexcept
1845  {
1846  GenericRectangle r( *this );
1847  r.InflateBy( dx, dy );
1848  return r;
1849  }
1850 
1855  template <typename T1>
1856  GenericRectangle InflatedBy( T1 d ) const noexcept
1857  {
1858  GenericRectangle r( *this );
1859  r.InflateBy( d );
1860  return r;
1861  }
1862 
1870  void InflateByFactors( double kx, double ky ) noexcept
1871  {
1872  InflateBy( kx*Width()/2, ky*Height()/2 );
1873  }
1874 
1881  void InflateByFactor( double k ) noexcept
1882  {
1883  InflateBy( k*Width()/2, k*Height()/2 );
1884  }
1885 
1891  GenericRectangle InflatedByFactors( double kx, double ky ) noexcept
1892  {
1893  GenericRectangle r( *this );
1894  r.InflateByFactors( kx, ky );
1895  return r;
1896  }
1897 
1903  GenericRectangle InflatedByFactor( double k ) noexcept
1904  {
1905  GenericRectangle r( *this );
1906  r.InflateByFactor( k );
1907  return r;
1908  }
1909 
1915  template <typename T1>
1916  void DeflateBy( T1 dx, T1 dy ) noexcept
1917  {
1918  if ( x1 < x0 )
1919  dx = -dx;
1920  if ( y1 < y0 )
1921  dy = -dy;
1922  x0 += dx;
1923  y0 += dy;
1924  x1 -= dx;
1925  y1 -= dy;
1926  }
1927 
1933  template <typename T1>
1934  void DeflateBy( T1 d ) noexcept
1935  {
1936  if ( x0 <= x1 )
1937  x0 += d, x1 -= d;
1938  else
1939  x0 -= d, x1 += d;
1940 
1941  if ( y0 <= y1 )
1942  y0 += d, y1 -= d;
1943  else
1944  y0 -= d, y1 += d;
1945  }
1946 
1951  template <typename T1>
1952  GenericRectangle DeflatedBy( T1 dx, T1 dy ) const noexcept
1953  {
1954  GenericRectangle r( *this );
1955  r.DeflateBy( dx, dy );
1956  return r;
1957  }
1958 
1963  template <typename T1>
1964  GenericRectangle DeflatedBy( T1 d ) const noexcept
1965  {
1966  GenericRectangle r( *this );
1967  r.DeflateBy( d );
1968  return r;
1969  }
1970 
1977  template <typename T1>
1978  GenericRectangle WidthSetTo( T1 w ) const noexcept
1979  {
1980  GenericRectangle r( *this );
1981  r.SetWidth( w );
1982  return r;
1983  }
1984 
1991  template <typename T1>
1992  GenericRectangle HeightSetTo( T1 h ) const noexcept
1993  {
1994  GenericRectangle r( *this );
1995  r.SetHeight( h );
1996  return r;
1997  }
1998 
2004  template <typename T1, typename T2>
2005  void Rotate( T1 angle, T2 xc, T2 yc ) noexcept
2006  {
2007  T1 sa, ca; pcl::SinCos( angle, sa, ca );
2008  pcl::Rotate( x0, y0, sa, ca, xc, yc );
2009  pcl::Rotate( x1, y1, sa, ca, xc, yc );
2010  }
2011 
2016  template <typename T1, typename T2>
2017  void Rotate( T1 angle, const GenericPoint<T2>& center ) noexcept
2018  {
2019  Rotate( angle, center.x, center.y );
2020  }
2021 
2027  template <typename T1, typename T2>
2028  void Rotate( T1 sa, T1 ca, T2 xc, T2 yc ) noexcept
2029  {
2030  pcl::Rotate( x0, y0, sa, ca, xc, yc );
2031  pcl::Rotate( x1, y1, sa, ca, xc, yc );
2032  }
2033 
2039  template <typename T1, typename T2>
2040  void Rotate( T1 sa, T1 ca, const GenericPoint<T2>& center ) noexcept
2041  {
2042  Rotate( sa, ca, center.x, center.y );
2043  }
2044 
2050  template <typename T1, typename T2>
2051  GenericRectangle Rotated( T1 angle, T2 xc, T2 yc ) const noexcept
2052  {
2053  GenericRectangle r( *this );
2054  r.Rotate( angle, xc, yc );
2055  return r;
2056  }
2057 
2063  template <typename T1, typename T2>
2064  GenericRectangle Rotated( T1 angle, const GenericPoint<T2>& center ) const noexcept
2065  {
2066  GenericRectangle r( *this );
2067  r.Rotate( angle, center );
2068  return r;
2069  }
2070 
2077  template <typename T1, typename T2>
2078  GenericRectangle Rotated( T1 sa, T1 ca, T2 xc, T2 yc ) const noexcept
2079  {
2080  GenericRectangle r( *this );
2081  r.Rotate( sa, ca, xc, yc );
2082  return r;
2083  }
2084 
2091  template <typename T1, typename T2>
2092  GenericRectangle Rotated( T1 sa, T1 ca, const GenericPoint<T2>& center ) const noexcept
2093  {
2094  GenericRectangle r( *this );
2095  r.Rotate( sa, ca, center );
2096  return r;
2097  }
2098 
2103  void Round() noexcept
2104  {
2105  x0 = component( pcl::Round( double( x0 ) ) );
2106  y0 = component( pcl::Round( double( y0 ) ) );
2107  x1 = component( pcl::Round( double( x1 ) ) );
2108  y1 = component( pcl::Round( double( y1 ) ) );
2109  }
2110 
2115  void Round( int n ) noexcept
2116  {
2117  PCL_PRECONDITION( n >= 0 )
2118  if ( n < 0 )
2119  n = 0;
2120  x0 = component( pcl::Round( double( x0 ), n ) );
2121  y0 = component( pcl::Round( double( y0 ), n ) );
2122  x1 = component( pcl::Round( double( x1 ), n ) );
2123  y1 = component( pcl::Round( double( y1 ), n ) );
2124  }
2125 
2130  GenericRectangle Rounded() const noexcept
2131  {
2132  return GenericRectangle( component( pcl::Round( double( x0 ) ) ), component( pcl::Round( double( y0 ) ) ),
2133  component( pcl::Round( double( x1 ) ) ), component( pcl::Round( double( y1 ) ) ) );
2134  }
2135 
2140  GenericRectangle Rounded( int n ) const noexcept
2141  {
2142  PCL_PRECONDITION( n >= 0 )
2143  return GenericRectangle( component( pcl::Round( double( x0 ), n ) ), component( pcl::Round( double( y0 ), n ) ),
2144  component( pcl::Round( double( x1 ), n ) ), component( pcl::Round( double( y1 ), n ) ) );
2145  }
2146 
2152  {
2153  return GenericRectangle<int>( pcl::RoundInt( double( x0 ) ), pcl::RoundInt( double( y0 ) ),
2154  pcl::RoundInt( double( x1 ) ), pcl::RoundInt( double( y1 ) ) );
2155  }
2156 
2162  void Truncate() noexcept
2163  {
2164  x0 = component( pcl::Trunc( double( x0 ) ) );
2165  y0 = component( pcl::Trunc( double( y0 ) ) );
2166  x1 = component( pcl::Trunc( double( x1 ) ) );
2167  y1 = component( pcl::Trunc( double( y1 ) ) );
2168  }
2169 
2176  GenericRectangle Truncated() const noexcept
2177  {
2178  return GenericRectangle( component( pcl::Trunc( double( x0 ) ) ), component( pcl::Trunc( double( y0 ) ) ),
2179  component( pcl::Trunc( double( x1 ) ) ), component( pcl::Trunc( double( y1 ) ) ) );
2180  }
2181 
2189  {
2190  return GenericRectangle<int>( pcl::TruncInt( double( x0 ) ), pcl::TruncInt( double( y0 ) ),
2191  pcl::TruncInt( double( x1 ) ), pcl::TruncInt( double( y1 ) ) );
2192  }
2193 
2198  template <typename T1>
2199  GenericRectangle& operator =( const GenericRectangle<T1>& r ) noexcept
2200  {
2201  x0 = component( r.x0 );
2202  y0 = component( r.y0 );
2203  x1 = component( r.x1 );
2204  y1 = component( r.y1 );
2205  return *this;
2206  }
2207 
2215  template <typename T1>
2216  GenericRectangle& operator =( const pcl::GenericPoint<T1>& p ) noexcept
2217  {
2218  x0 = x1 = component( p.x );
2219  y0 = y1 = component( p.y );
2220  return *this;
2221  }
2222 
2229  GenericRectangle& operator =( component d ) noexcept
2230  {
2231  x0 = y0 = x1 = y1 = d;
2232  return *this;
2233  }
2234 
2235 #ifdef __PCL_QT_INTERFACE
2236  GenericRectangle& operator =( const QRect& r ) noexcept
2237  {
2238  x0 = component( r.left() );
2239  y0 = component( r.top() );
2240  x1 = component( r.right()+1 );
2241  y1 = component( r.bottom()+1 );
2242  return *this;
2243  }
2244 #endif
2245 
2258  template <typename T1>
2259  GenericRectangle& operator +=( const GenericRectangle<T1>& r ) noexcept
2260  {
2261  x0 += component( r.x0 );
2262  y0 += component( r.y0 );
2263  x1 += component( r.x1 );
2264  y1 += component( r.y1 );
2265  return *this;
2266  }
2267 
2281  template <typename T1>
2282  GenericRectangle& operator +=( const pcl::GenericPoint<T1>& p ) noexcept
2283  {
2284  x0 += component( p.x );
2285  y0 += component( p.y );
2286  x1 += component( p.x );
2287  y1 += component( p.y );
2288  return *this;
2289  }
2290 
2305  GenericRectangle& operator +=( component d ) noexcept
2306  {
2307  x0 += d;
2308  y0 += d;
2309  x1 += d;
2310  y1 += d;
2311  return *this;
2312  }
2313 
2314 #ifdef __PCL_QT_INTERFACE
2315  GenericRectangle& operator +=( const QPoint& p ) noexcept
2316  {
2317  component dx = component( p.x() ), dy = component( p.y() );
2318  x0 += dx;
2319  y0 += dy;
2320  x1 += dx;
2321  y1 += dy;
2322  return *this;
2323  }
2324 #endif
2325 
2338  template <typename T1>
2339  GenericRectangle& operator -=( const GenericRectangle<T1>& r ) noexcept
2340  {
2341  x0 -= component( r.x0 );
2342  y0 -= component( r.y0 );
2343  x1 -= component( r.x1 );
2344  y1 -= component( r.y1 );
2345  return *this;
2346  }
2347 
2361  template <typename T1>
2362  GenericRectangle& operator -=( const pcl::GenericPoint<T1>& p ) noexcept
2363  {
2364  x0 -= component( p.x );
2365  y0 -= component( p.y );
2366  x1 -= component( p.x );
2367  y1 -= component( p.y );
2368  return *this;
2369  }
2370 
2385  GenericRectangle& operator -=( component d ) noexcept
2386  {
2387  x0 -= d;
2388  y0 -= d;
2389  x1 -= d;
2390  y1 -= d;
2391  return *this;
2392  }
2393 
2394 #ifdef __PCL_QT_INTERFACE
2395  GenericRectangle& operator -=( const QPoint& p ) noexcept
2396  {
2397  component dx = component( p.x() ), dy = component( p.y() );
2398  x0 -= dx;
2399  y0 -= dy;
2400  x1 -= dx;
2401  y1 -= dy;
2402  return *this;
2403  }
2404 #endif
2405 
2418  template <typename T1>
2419  GenericRectangle& operator *=( const GenericRectangle<T1>& r ) noexcept
2420  {
2421  x0 *= component( r.x0 );
2422  y0 *= component( r.y0 );
2423  x1 *= component( r.x1 );
2424  y1 *= component( r.y1 );
2425  return *this;
2426  }
2427 
2442  template <typename T1>
2443  GenericRectangle& operator *=( const pcl::GenericPoint<T1>& p ) noexcept
2444  {
2445  x0 *= component( p.x );
2446  y0 *= component( p.y );
2447  x1 *= component( p.x );
2448  y1 *= component( p.y );
2449  return *this;
2450  }
2451 
2466  GenericRectangle& operator *=( component d ) noexcept
2467  {
2468  x0 *= d;
2469  y0 *= d;
2470  x1 *= d;
2471  y1 *= d;
2472  return *this;
2473  }
2474 
2475 #ifdef __PCL_QT_INTERFACE
2476  GenericRectangle& operator *=( const QPoint& p ) noexcept
2477  {
2478  component dx = component( p.x() ), dy = component( p.y() );
2479  x0 *= dx; y0 *= dy; x1 *= dx; y1 *= dy;
2480  return *this;
2481  }
2482 #endif
2483 
2496  template <typename T1>
2497  GenericRectangle& operator /=( const GenericRectangle<T1>& r ) noexcept
2498  {
2499  PCL_PRECONDITION( component( r.x0 ) != component( 0 ) && component( r.y0 ) != component( 0 ) &&
2500  component( r.x1 ) != component( 0 ) && component( r.y1 ) != component( 0 ) )
2501  x0 /= component( r.x0 );
2502  y0 /= component( r.y0 );
2503  x1 /= component( r.x1 );
2504  y1 /= component( r.y1 );
2505  return *this;
2506  }
2507 
2522  template <typename T1>
2523  GenericRectangle& operator /=( const pcl::GenericPoint<T1>& p ) noexcept
2524  {
2525  PCL_PRECONDITION( component( p.x ) != component( 0 ) && component( p.y ) != component( 0 ) )
2526  x0 /= component( p.x );
2527  y0 /= component( p.y );
2528  x1 /= component( p.x );
2529  y1 /= component( p.y );
2530  return *this;
2531  }
2532 
2547  GenericRectangle& operator /=( component d ) noexcept
2548  {
2549  PCL_PRECONDITION( d != component( 0 ) )
2550  x0 /= d; y0 /= d; x1 /= d; y1 /= d;
2551  return *this;
2552  }
2553 
2554 #ifdef __PCL_QT_INTERFACE
2555  GenericRectangle& operator /=( const QPoint& p ) noexcept
2556  {
2557  PCL_PRECONDITION( component( p.x() ) != component( 0 ) && component( p.y() ) != component( 0 ) )
2558  component dx = component( p.x() ), dy = component( p.y() );
2559  x0 /= dx;
2560  y0 /= dy;
2561  x1 /= dx;
2562  y1 /= dy;
2563  return *this;
2564  }
2565 #endif
2566 
2570  GenericRectangle operator +() const noexcept
2571  {
2572  return *this;
2573  }
2574 
2581  GenericRectangle operator -() const noexcept
2582  {
2583  return GenericRectangle( -x0, -y0, -x1, -y1 );
2584  }
2585 
2586 #ifdef __PCL_QT_INTERFACE
2587  operator QRect() const noexcept
2588  {
2589  return QRect( int( x0 ), int( y0 ), int( x1-x0 ), int( y1-y0 ) );
2590  }
2591 #endif
2592 
2593 #ifdef __PCL_QT_INTERFACE
2594 # ifndef __PCL_QT_NO_RECT_DRAWING_HELPERS
2595 
2596  void Draw( QPainter& p, const QBrush* b ) const
2597  {
2598  int rx0, ry0, rx1, ry1;
2599 
2600  if ( x0 <= x1 )
2601  rx0 = x0, rx1 = x1;
2602  else
2603  rx0 = x1, rx1 = x0;
2604 
2605  if ( y0 <= y1 )
2606  ry0 = y0, ry1 = y1;
2607  else
2608  ry0 = y1, ry1 = y0;
2609 
2610  if ( rx1 - rx0 <= 1 )
2611  {
2612  if ( ry1 - ry0 <= 1 )
2613  p.drawPoint( rx0, ry0 );
2614  else
2615  p.drawLine( rx0, ry0, rx0, ry1-1 );
2616  }
2617  else if ( ry1 - ry0 <= 1 )
2618  {
2619  p.drawLine( rx0, ry0, rx1-1, ry0 );
2620  }
2621  else
2622  {
2623 # if ( QT_VERSION >= 0x040000 )
2624  int w = rx1-rx0-1, h = ry1-ry0-1;
2625 # else
2626  int w = rx1-rx0, h = ry1-ry0;
2627 # endif
2628  if ( b != 0 )
2629  p.fillRect( rx0, ry0, w, h, *b );
2630  p.drawRect( rx0, ry0, w, h );
2631  }
2632  }
2633 
2634  void Draw( QPainter& p ) const
2635  {
2636  Draw( p, 0 );
2637  }
2638 
2639  void Draw( QPainter& p, const QColor& c ) const
2640  {
2641  QBrush b( c );
2642  Draw( p, &b );
2643  }
2644 
2645 # endif // !__PCL_QT_NO_RECT_DRAWING_HELPERS
2646 #endif // __PCL_QT_INTERFACE
2647 
2648 }; // GenericRectangle<T>
2649 
2650 #undef PCL_ASSERT_RECT_SIZE
2651 
2652 // ----------------------------------------------------------------------------
2653 
2663 template <typename T1, typename T2> inline
2664 bool operator ==( const GenericRectangle<T1>& r1, const GenericRectangle<T2>& r2 ) noexcept
2665 {
2666  return r1.x0 == r2.x0 && r1.y0 == r2.y0 && r1.x1 == r2.x1 && r1.y1 == r2.y1;
2667 }
2668 
2674 template <typename T> inline
2675 bool operator ==( const GenericRectangle<T>& r1, T d2 ) noexcept
2676 {
2677  return r1.x0 == d2 && r1.y0 == d2 && r1.x1 == d2 && r1.y1 == d2;
2678 }
2679 
2686 template <typename T> inline
2687 bool operator ==( T d1, const GenericRectangle<T>& r2 ) noexcept
2688 {
2689  return d1 == r2.x0 && d1 == r2.y0 && d1 == r2.x1 && d1 == r2.y1;
2690 }
2691 
2698 template <typename T1, typename T2> inline
2699 bool operator <( const GenericRectangle<T1>& r1, const GenericRectangle<T2>& r2 ) noexcept
2700 {
2701  T1 x01 = Min( r1.x0, r1.x1 ); T1 y01 = Min( r1.y0, r1.y1 );
2702  T1 x11 = Max( r1.x0, r1.x1 ); T1 y11 = Max( r1.y0, r1.y1 );
2703  T2 x02 = Min( r2.x0, r2.x1 ); T2 y02 = Min( r2.y0, r2.y1 );
2704  T2 x12 = Max( r2.x0, r2.x1 ); T2 y12 = Max( r2.y0, r2.y1 );
2705  if ( y01 != y02 )
2706  return y01 < y02;
2707  if ( x01 != x02 )
2708  return x01 < x02;
2709  if ( y11 != y12 )
2710  return y11 < y12;
2711  return x11 < x12;
2712 }
2713 
2729 template <typename T1, typename T2> inline
2731 {
2732  return GenericRectangle<T1>( T1( r1.x0 + r2.x0 ), T1( r1.y0 + r2.y0 ),
2733  T1( r1.x1 + r2.x1 ), T1( r1.y1 + r2.y1 ) );
2734 }
2735 
2750 template <typename T1, typename T2> inline
2752 {
2753  return GenericRectangle<T1>( T1( r1.x0 + p2.x ), T1( r1.y0 + p2.y ),
2754  T1( r1.x1 + p2.x ), T1( r1.y1 + p2.y ) );
2755 }
2756 
2766 template <typename T1, typename T2> inline
2768 {
2769  return GenericRectangle<T2>( T2( p1.x + r2.x0 ), T2( p1.y + r2.y0 ),
2770  T2( p1.x + r2.x1 ), T2( p1.y + r2.y1 ) );
2771 }
2772 
2787 template <typename T> inline
2789 {
2790  return GenericRectangle<T>( r1.x0+d2, r1.y0+d2, r1.x1+d2, r1.y1+d2 );
2791 }
2792 
2802 template <typename T> inline
2804 {
2805  return GenericRectangle<T>( d1+r2.x0, d1+r2.y0, d1+r2.x1, d1+r2.y1 );
2806 }
2807 
2823 template <typename T1, typename T2> inline
2825 {
2826  return GenericRectangle<T1>( T1( r1.x0 - r2.x0 ), T1( r1.y0 - r2.y0 ),
2827  T1( r1.x1 - r2.x1 ), T1( r1.y1 - r2.y1 ) );
2828 }
2829 
2844 template <typename T1, typename T2> inline
2846 {
2847  return GenericRectangle<T1>( T1( r1.x0 - p2.x ), T1( r1.y0 - p2.y ),
2848  T1( r1.x1 - p2.x ), T1( r1.y1 - p2.y ) );
2849 }
2850 
2865 template <typename T1, typename T2> inline
2867 {
2868  return GenericRectangle<T2>( T2( p1.x - r2.x0 ), T2( p1.y - r2.y0 ),
2869  T2( p1.x - r2.x1 ), T2( p1.y - r2.y1 ) );
2870 }
2871 
2886 template <typename T> inline
2888 {
2889  return GenericRectangle<T>( r1.x0-d2, r1.y0-d2, r1.x1-d2, r1.y1-d2 );
2890 }
2891 
2906 template <typename T> inline
2908 {
2909  return GenericRectangle<T>( d1-r2.x0, d1-r2.y0, d1-r2.x1, d1-r2.y1 );
2910 }
2911 
2927 template <typename T1, typename T2> inline
2929 {
2930  return GenericRectangle<T1>( T1( r1.x0 * r2.x0 ), T1( r1.y0 * r2.y0 ),
2931  T1( r1.x1 * r2.x1 ), T1( r1.y1 * r2.y1 ) );
2932 }
2933 
2948 template <typename T1, typename T2> inline
2950 {
2951  return GenericRectangle<T1>( T1( r1.x0 * p2.x ), T1( r1.y0 * p2.y ),
2952  T1( r1.x1 * p2.x ), T1( r1.y1 * p2.y ) );
2953 }
2954 
2964 template <typename T1, typename T2> inline
2966 {
2967  return GenericRectangle<T2>( T2( p1.x * r2.x0 ), T2( p1.y * r2.y0 ),
2968  T2( p1.x * r2.x1 ), T2( p1.y * r2.y1 ) );
2969 }
2970 
2985 template <typename T> inline
2987 {
2988  return GenericRectangle<T>( r1.x0*d2, r1.y0*d2, r1.x1*d2, r1.y1*d2 );
2989 }
2990 
3000 template <typename T> inline
3002 {
3003  return GenericRectangle<T>( d1*r2.x0, d1*r2.y0, d1*r2.x1, d1*r2.y1 );
3004 }
3005 
3021 template <typename T1, typename T2> inline
3023 {
3024  PCL_PRECONDITION( r2.x0 != T2( 0 ) && r2.y0 != T2( 0 ) &&
3025  r2.x1 != T2( 0 ) && r2.y1 != T2( 0 ) )
3026  return GenericRectangle<T1>( T1( r1.x0 / r2.x0 ), T1( r1.y0 / r2.y0 ),
3027  T1( r1.x1 / r2.x1 ), T1( r1.y1 / r2.y1 ) );
3028 }
3029 
3044 template <typename T1, typename T2> inline
3046 {
3047  PCL_PRECONDITION( p2.x != T2( 0 ) && p2.y != T2( 0 ) )
3048  return GenericRectangle<T1>( T1( r1.x0 / p2.x ), T1( r1.y0 / p2.y ),
3049  T1( r1.x1 / p2.x ), T1( r1.y1 / p2.y ) );
3050 }
3051 
3066 template <typename T1, typename T2> inline
3068 {
3069  PCL_PRECONDITION( r2.x0 != T2( 0 ) && r2.y0 != T2( 0 ) &&
3070  r2.x1 != T2( 0 ) && r2.y1 != T2( 0 ) )
3071  return GenericRectangle<T2>( T2( p1.x / r2.x0 ), T2( p1.y / r2.y0 ),
3072  T2( p1.x / r2.x1 ), T2( p1.y / r2.y1 ) );
3073 }
3074 
3089 template <typename T> inline
3091 {
3092  PCL_PRECONDITION( d2 != T( 0 ) )
3093  return GenericRectangle<T>( r1.x0/d2, r1.y0/d2, r1.x1/d2, r1.y1/d2 );
3094 }
3095 
3110 template <typename T> inline
3112 {
3113  PCL_PRECONDITION( r2.x0 != T( 0 ) && r2.y0 != T( 0 ) &&
3114  r2.x1 != T( 0 ) && r2.y1 != T( 0 ) )
3115  return GenericRectangle<T>( d1/r2.x0, d1/r2.y0, d1/r2.x1, d1/r2.y1 );
3116 }
3117 
3133 template <typename T, typename T1, typename T2> inline
3134 void Rotate( GenericRectangle<T>& r, T1 a, T2 xc, T2 yc ) noexcept
3135 {
3136  T1 sa, ca; pcl::SinCos( a, sa, ca );
3137  pcl::Rotate( r.x0, r.y0, sa, ca, xc, yc );
3138  pcl::Rotate( r.x1, r.y1, sa, ca, xc, yc );
3139 }
3140 
3156 template <typename T, typename T1, typename T2> inline
3157 void Rotate( GenericRectangle<T>& r, T1 a, const GenericPoint<T2>& c ) noexcept
3158 {
3159  pcl::Rotate( r, a, c.x, c.y );
3160 }
3161 
3177 template <typename T, typename T1, typename T2> inline
3178 void Rotate( GenericRectangle<T>& r, T1 sa, T1 ca, T2 xc, T2 yc ) noexcept
3179 {
3180  pcl::Rotate( r.x0, r.y0, sa, ca, xc, yc );
3181  pcl::Rotate( r.x1, r.y1, sa, ca, xc, yc );
3182 }
3183 
3199 template <typename T, typename T1, typename T2> inline
3200 void Rotate( GenericRectangle<T>& r, T1 sa, T1 ca, const GenericPoint<T2>& c ) noexcept
3201 {
3202  pcl::Rotate( r, sa, ca, c.x, c.y );
3203 }
3204 
3216 template <typename T> inline
3218 {
3219  pcl::Swap( r1.x0, r2.x0 ); pcl::Swap( r1.y0, r2.y0 );
3220  pcl::Swap( r1.x1, r2.x1 ); pcl::Swap( r1.y1, r2.y1 );
3221 }
3222 
3223 // ----------------------------------------------------------------------------
3224 
3225 #ifndef __PCL_NO_RECT_INSTANTIATE
3226 
3238 using I32Rect = GenericRectangle<int32>;
3239 
3248 using Rect = I32Rect;
3249 
3257 using F32Rect = GenericRectangle<float>;
3258 
3267 using FRect = F32Rect;
3268 
3276 using F64Rect = GenericRectangle<double>;
3277 
3286 using DRect = F64Rect;
3287 
3288 #endif
3289 
3290 // ----------------------------------------------------------------------------
3291 
3292 } // pcl
3293 
3294 #endif // __PCL_Rectangle_h
3295 
3296 // ----------------------------------------------------------------------------
3297 // EOF pcl/Rectangle.h - Released 2024-12-28T16:53:48Z
64-bit floating-point rectangle in the R^2 space.
32-bit floating-point rectangle in the R^2 space.
64-bit floating-point rectangle in the R^2 space.
32-bit floating-point rectangle in the R^2 space.
A type-safe collection of enumerated flags.
Definition: Flags.h:85
A generic point in the two-dimensional space.
Definition: Point.h:100
A generic rectangle in the two-dimensional space.
Definition: Rectangle.h:316
point BottomRight() const noexcept
Definition: Rectangle.h:588
GenericRectangle Truncated() const noexcept
Definition: Rectangle.h:2176
GenericRectangle(const pcl::GenericPoint< T1 > &leftTop, const pcl::GenericPoint< T1 > &rightBottom)
Definition: Rectangle.h:427
bool IsPointOrLine() const noexcept
Definition: Rectangle.h:755
component Left() const noexcept
Definition: Rectangle.h:493
constexpr GenericRectangle(component d)
Definition: Rectangle.h:455
void MoveBy(const pcl::GenericPoint< T1 > &d) noexcept
Definition: Rectangle.h:1619
void SetWidth(T1 w) noexcept
Definition: Rectangle.h:1777
GenericRectangle Rotated(T1 angle, const GenericPoint< T2 > &center) const noexcept
Definition: Rectangle.h:2064
void Round() noexcept
Definition: Rectangle.h:2103
component Perimeter() const noexcept
Definition: Rectangle.h:655
double CenterY() const noexcept
Definition: Rectangle.h:694
constexpr GenericRectangle(T1 left, T1 top, T1 right, T1 bottom)
Definition: Rectangle.h:359
GenericRectangle IntersectionFast(const GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1496
bool IntersectsFast(const pcl::GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1212
ClipFlags ClipCodeFast(const pcl::GenericPoint< T1 > &p) const noexcept
Definition: Rectangle.h:897
void Round(int n) noexcept
Definition: Rectangle.h:2115
point LeftTop() const noexcept
Definition: Rectangle.h:529
void UniteFast(T1 left, T1 top, T1 right, T1 bottom) noexcept
Definition: Rectangle.h:1301
component x1
Horizontal coordinate of the lower right corner.
Definition: Rectangle.h:336
void Unite(T1 left, T1 top, T1 right, T1 bottom) noexcept
Definition: Rectangle.h:1238
GenericRectangle Rounded(int n) const noexcept
Definition: Rectangle.h:2140
void MoveTo(T1 x, T1 y) noexcept
Definition: Rectangle.h:1570
GenericRectangle InflatedByFactors(double kx, double ky) noexcept
Definition: Rectangle.h:1891
point RightTop() const noexcept
Definition: Rectangle.h:546
bool Intersect(T1 left, T1 top, T1 right, T1 bottom) noexcept
Definition: Rectangle.h:1394
double CenterX() const noexcept
Definition: Rectangle.h:685
bool IsOrdered() const noexcept
Definition: Rectangle.h:780
component Area() const noexcept
Definition: Rectangle.h:676
void MoveBy(T1 dx, T1 dy) noexcept
Definition: Rectangle.h:1630
GenericRectangle InflatedBy(T1 dx, T1 dy) const noexcept
Definition: Rectangle.h:1844
component Bottom() const noexcept
Definition: Rectangle.h:520
GenericRectangle InflatedBy(T1 d) const noexcept
Definition: Rectangle.h:1856
point CenterLeft() const noexcept
Definition: Rectangle.h:620
void InflateBy(T1 d) noexcept
Definition: Rectangle.h:1826
constexpr GenericRectangle(component width, component height)
Definition: Rectangle.h:442
void DeflateBy(T1 d) noexcept
Definition: Rectangle.h:1934
component y1
Vertical coordinate of the lower right corner.
Definition: Rectangle.h:337
point TopLeft() const noexcept
Definition: Rectangle.h:537
point Center() const noexcept
Definition: Rectangle.h:596
point LeftBottom() const noexcept
Definition: Rectangle.h:563
void InflateBy(T1 dx, T1 dy) noexcept
Definition: Rectangle.h:1808
point CenterBottom() const noexcept
Definition: Rectangle.h:612
bool IsRect() const noexcept
Definition: Rectangle.h:764
GenericRectangle InflatedByFactor(double k) noexcept
Definition: Rectangle.h:1903
bool IsVerticalLine() const noexcept
Definition: Rectangle.h:747
GenericRectangle Rotated(T1 sa, T1 ca, const GenericPoint< T2 > &center) const noexcept
Definition: Rectangle.h:2092
void InflateByFactors(double kx, double ky) noexcept
Definition: Rectangle.h:1870
bool IsHorizontalLine() const noexcept
Definition: Rectangle.h:739
GenericRectangle Rotated(T1 sa, T1 ca, T2 xc, T2 yc) const noexcept
Definition: Rectangle.h:2078
GenericRectangle< int > RoundedToInt() const noexcept
Definition: Rectangle.h:2151
GenericRectangle< int > TruncatedToInt() const noexcept
Definition: Rectangle.h:2188
point RightBottom() const noexcept
Definition: Rectangle.h:580
bool ClipLineFast(pcl::GenericPoint< T1 > &p0, pcl::GenericPoint< T1 > &p1) const noexcept
Definition: Rectangle.h:1073
void ResizeTo(T1 w, T1 h) noexcept
Definition: Rectangle.h:1702
bool IsNormal() const noexcept
Definition: Rectangle.h:772
component y0
Vertical coordinate of the upper left corner.
Definition: Rectangle.h:335
bool IntersectsFast(T1 left, T1 top, T1 right, T1 bottom) const noexcept
Definition: Rectangle.h:1200
bool Includes(T1 x, T1 y) const noexcept
Definition: Rectangle.h:1083
component x0
Horizontal coordinate of the upper left corner.
Definition: Rectangle.h:334
ClipFlags ClipCodeFast(T1 x, T1 y) const noexcept
Definition: Rectangle.h:873
void Set(T1 left, T1 top, T1 right, T1 bottom) noexcept
Definition: Rectangle.h:1541
GenericRectangle Rotated(T1 angle, T2 xc, T2 yc) const noexcept
Definition: Rectangle.h:2051
GenericRectangle MovedTo(const pcl::GenericPoint< T1 > &p) const noexcept
Definition: Rectangle.h:1593
void DeflateBy(T1 dx, T1 dy) noexcept
Definition: Rectangle.h:1916
point CenterTop() const noexcept
Definition: Rectangle.h:604
GenericRectangle ResizedBy(T1 dw, T1 dh) const noexcept
Definition: Rectangle.h:1761
void UniteFast(const GenericRectangle< T1 > &r) noexcept
Definition: Rectangle.h:1276
void Rotate(T1 sa, T1 ca, T2 xc, T2 yc) noexcept
Definition: Rectangle.h:2028
void InflateByFactor(double k) noexcept
Definition: Rectangle.h:1881
GenericRectangle UnionFast(const GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1327
bool Intersects(const pcl::GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1168
ClipFlags ClipCode(T1 x, T1 y) const noexcept
Definition: Rectangle.h:814
void Order() noexcept
Definition: Rectangle.h:788
GenericRectangle HeightSetTo(T1 h) const noexcept
Definition: Rectangle.h:1992
bool ClipLine(pcl::GenericPoint< T1 > &p0, pcl::GenericPoint< T1 > &p1) const noexcept
Definition: Rectangle.h:983
component Right() const noexcept
Definition: Rectangle.h:511
GenericRectangle MovedBy(T1 dx, T1 dy) const noexcept
Definition: Rectangle.h:1684
bool Includes(const GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1102
bool Includes(const pcl::GenericPoint< T1 > &p) const noexcept
Definition: Rectangle.h:1093
point CenterRight() const noexcept
Definition: Rectangle.h:628
GenericRectangle ResizedTo(T1 w, T1 h) const noexcept
Definition: Rectangle.h:1722
bool IntersectFast(const GenericRectangle< T1 > &r) noexcept
Definition: Rectangle.h:1438
void Unite(const GenericRectangle< T1 > &r) noexcept
Definition: Rectangle.h:1222
bool ClipLineFast(T1 &lx0, T1 &ly0, T1 &lx1, T1 &ly1) const noexcept
Definition: Rectangle.h:1009
bool IncludesFast(const pcl::GenericPoint< T1 > &p) const noexcept
Definition: Rectangle.h:1141
bool IntersectFast(T1 left, T1 top, T1 right, T1 bottom) noexcept
Definition: Rectangle.h:1467
void Rotate(T1 angle, T2 xc, T2 yc) noexcept
Definition: Rectangle.h:2005
void ResizeBy(T1 dw, T1 dh) noexcept
Definition: Rectangle.h:1741
double Hypot() const noexcept
Definition: Rectangle.h:705
bool IsPoint() const noexcept
Definition: Rectangle.h:723
void Rotate(T1 angle, const GenericPoint< T2 > &center) noexcept
Definition: Rectangle.h:2017
void MoveTo(const pcl::GenericPoint< T1 > &p) noexcept
Definition: Rectangle.h:1557
GenericRectangle DeflatedBy(T1 d) const noexcept
Definition: Rectangle.h:1964
bool Intersect(const GenericRectangle< T1 > &r) noexcept
Definition: Rectangle.h:1374
GenericRectangle DeflatedBy(T1 dx, T1 dy) const noexcept
Definition: Rectangle.h:1952
GenericRectangle(std::initializer_list< T1 > l)
Definition: Rectangle.h:394
point TopRight() const noexcept
Definition: Rectangle.h:554
point BottomLeft() const noexcept
Definition: Rectangle.h:571
ClipFlags ClipCode(const pcl::GenericPoint< T1 > &p) const noexcept
Definition: Rectangle.h:853
component ManhattanDistance() const noexcept
Definition: Rectangle.h:667
GenericRectangle(const GenericRectangle< T1 > &r)
Definition: Rectangle.h:466
constexpr GenericRectangle()
Definition: Rectangle.h:343
GenericRectangle Union(const GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1313
GenericRectangle Ordered() const noexcept
Definition: Rectangle.h:796
component Top() const noexcept
Definition: Rectangle.h:502
component Width() const noexcept
Definition: Rectangle.h:637
bool IncludesFast(T1 x, T1 y) const noexcept
Definition: Rectangle.h:1128
GenericRectangle MovedBy(const pcl::GenericPoint< T1 > &d) const noexcept
Definition: Rectangle.h:1670
GenericRectangle MovedTo(T1 x, T1 y) const noexcept
Definition: Rectangle.h:1607
component Height() const noexcept
Definition: Rectangle.h:646
void MoveBy(T1 dxy) noexcept
Definition: Rectangle.h:1648
void SetHeight(T1 h) noexcept
Definition: Rectangle.h:1794
double Diagonal() const noexcept
Definition: Rectangle.h:715
GenericRectangle Intersection(const GenericRectangle< T1 > &r) const noexcept
Definition: Rectangle.h:1481
void Truncate() noexcept
Definition: Rectangle.h:2162
GenericRectangle Rounded() const noexcept
Definition: Rectangle.h:2130
bool ClipLine(T1 &lx0, T1 &ly0, T1 &lx1, T1 &ly1) const noexcept
Definition: Rectangle.h:919
GenericRectangle WidthSetTo(T1 w) const noexcept
Definition: Rectangle.h:1978
void Rotate(T1 sa, T1 ca, const GenericPoint< T2 > &center) noexcept
Definition: Rectangle.h:2040
bool IsLine() const noexcept
Definition: Rectangle.h:731
bool Intersects(T1 left, T1 top, T1 right, T1 bottom) const noexcept
Definition: Rectangle.h:1157
32-bit integer rectangle on the plane.
32-bit integer rectangle on the plane.
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Definition: Array.h:2285
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Definition: Array.h:2296
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:518
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:562
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:478
Complex< T1 > operator/(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:606
Complex< T > Sqrt(const Complex< T > &c) noexcept
Definition: Complex.h:688
T Abs(const Complex< T > &c) noexcept
Definition: Complex.h:443
Complex< T > Round(const Complex< T > &c) noexcept
Definition: Complex.h:952
void SinCos(T x, T &sx, T &cx) noexcept
Definition: Math.h:1101
void Rotate(T &x, T &y, T1 sa, T1 ca, T2 xc, T2 yc) noexcept
Definition: Math.h:2055
T Trunc(T x) noexcept
Definition: Math.h:1166
int RoundInt(T x) noexcept
Definition: Math.h:1550
int TruncInt(T x) noexcept
Definition: Math.h:1203
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
Definition: Point.h:1459
bool IsHorizontalLine(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:161
bool IsNormalRect(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:228
bool IsRect(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:212
bool IsOrderedRect(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:245
bool IsLine(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:144
bool IsVerticalLine(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:178
bool IsPointOrLine(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:195
bool IsPoint(T x0, T y0, T x1, T y1) noexcept
Definition: Rectangle.h:126
void OrderRect(T &x0, T &y0, T &x1, T &y1) noexcept
Definition: Rectangle.h:262
constexpr const T & Min(const T &a, const T &b) noexcept
Definition: Utility.h:90
constexpr const T & Max(const T &a, const T &b) noexcept
Definition: Utility.h:119
PCL root namespace.
Definition: AbstractImage.h:77