PCL
Point.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.7.0
6 // ----------------------------------------------------------------------------
7 // pcl/Point.h - Released 2024-06-18T15:48:54Z
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_Point_h
53 #define __PCL_Point_h
54 
56 
57 #include <pcl/Defs.h>
58 
59 #include <pcl/Math.h>
60 #include <pcl/Relational.h>
61 
62 #ifdef __PCL_QT_INTERFACE
63 # include <QtCore/QPoint>
64 #endif
65 
66 namespace pcl
67 {
68 
69 // ----------------------------------------------------------------------------
70 
71 /*
72  * ### NB: Template class GenericPoint cannot have virtual member functions.
73  * This is because internal PCL and core routines rely on
74  * GenericPoint<int>, GenericPoint<float> and GenericPoint<double> to
75  * be directly castable to int*, float* and double*, respectively. See
76  * also the PCL_ASSERT_POINT_SIZE() macro.
77  */
78 
79 #define PCL_ASSERT_POINT_SIZE() \
80  static_assert( sizeof( *this ) == 2*sizeof( T ), "Invalid sizeof( GenericPoint<> )" )
81 
98 template <typename T>
99 class PCL_CLASS GenericPoint
100 {
101 public:
102 
106  using component = T;
107 
108  /*
109  * Point coordinates
110  */
113 
118  constexpr GenericPoint()
119  {
120  PCL_ASSERT_POINT_SIZE();
121  }
122 
129  template <typename T1, typename T2>
130  constexpr GenericPoint( T1 xPos, T2 yPos )
131  : x( component( xPos ) )
132  , y( component( yPos ) )
133  {
134  PCL_ASSERT_POINT_SIZE();
135  }
136 
141  constexpr GenericPoint( component d )
142  : GenericPoint( d, d )
143  {
144  PCL_ASSERT_POINT_SIZE();
145  }
146 
172  template <typename T1>
173  GenericPoint( std::initializer_list<T1> l )
174  {
175  PCL_ASSERT_POINT_SIZE();
176  switch ( l.size() )
177  {
178  default:
179  case 2: y = component( l.begin()[1] );
180  case 1: x = component( l.begin()[0] );
181  case 0: break;
182  }
183  switch ( l.size() )
184  {
185  case 0: x = component( 0 );
186  case 1: y = component( 0 );
187  default:
188  case 2: break;
189  }
190  }
191 
199  template <typename T1>
201  : GenericPoint( p.x, p.y )
202  {
203  PCL_ASSERT_POINT_SIZE();
204  }
205 
206 #ifdef __PCL_QT_INTERFACE
207  GenericPoint( const QPoint& p )
208  : GenericPoint( p.x(), p.y() )
209  {
210  PCL_ASSERT_POINT_SIZE();
211  }
212 #endif
213 
230  template <typename T1>
231  double SquaredDistanceTo( const GenericPoint<T1>& p ) const noexcept
232  {
233  double dx = double( p.x ) - double( x );
234  double dy = double( p.y ) - double( y );
235  return dx*dx + dy*dy;
236  }
237 
249  template <typename T1>
250  double DistanceTo( const GenericPoint<T1>& p ) const noexcept
251  {
252  return pcl::Sqrt( SquaredDistanceTo( p ) );
253  }
254 
269  double SquaredDistanceToOrigin() const noexcept
270  {
271  return double( x )*double( x ) + double( y )*double( y );
272  }
273 
287  double DistanceToOrigin() const noexcept
288  {
289  return pcl::Sqrt( SquaredDistanceToOrigin() );
290  }
291 
303  template <typename T1>
304  double ManhattanDistanceTo( const GenericPoint<T1>& p ) const noexcept
305  {
306  return Abs( double( p.x ) - double( x ) ) + Abs( double( p.y ) - double( y ) );
307  }
308 
322  double ManhattanDistanceToOrigin() const noexcept
323  {
324  return Abs( double( x ) ) + Abs( double( y ) );
325  }
326 
334  template <typename T1>
335  void MoveTo( const GenericPoint<T1>& p ) noexcept
336  {
337  MoveTo( p.x, p.y );
338  }
339 
348  template <typename T1, typename T2>
349  void MoveTo( T1 xPos, T2 yPos ) noexcept
350  {
351  x = component( xPos ); y = component( yPos );
352  }
353 
354 #ifdef __PCL_QT_INTERFACE
355  void MoveTo( const QPoint& p ) noexcept
356  {
357  MoveTo( p.x(), p.y() );
358  }
359 #endif
360 
367  template <typename T1>
368  GenericPoint MovedTo( const GenericPoint<T1>& p ) const noexcept
369  {
370  return GenericPoint( component( p.x ), component( p.y ) );
371  }
372 
378  template <typename T1, typename T2>
379  GenericPoint MovedTo( T1 xPos, T2 yPos ) const noexcept
380  {
381  return GenericPoint( component( xPos ), component( yPos ) );
382  }
383 
395  template <typename T1>
396  void MoveBy( const GenericPoint<T1>& d ) noexcept
397  {
398  MoveBy( d.x, d.y );
399  }
400 
420  template <typename T1, typename T2>
421  void MoveBy( T1 dx, T2 dy ) noexcept
422  {
423  x += component( dx ); y += component( dy );
424  }
425 
436  template <typename T1>
437  void MoveBy( T1 dxy ) noexcept
438  {
439  x += component( dxy ); y += component( dxy );
440  }
441 
442 #ifdef __PCL_QT_INTERFACE
443  void MoveBy( const QPoint& p )
444  {
445  MoveBy( p.x(), p.y() );
446  }
447 #endif
448 
455  template <typename T1>
456  GenericPoint MovedBy( const GenericPoint<T1>& d ) const noexcept
457  {
458  return GenericPoint( x + component( d.x ), y + component( d.y ) );
459  }
460 
467  template <typename T1, typename T2>
468  GenericPoint MovedBy( T1 dx, T2 dy ) const noexcept
469  {
470  return GenericPoint( x + component( dx ), y + component( dy ) );
471  }
472 
480  template <typename T1, typename T2>
481  void Rotate( T1 angle, T2 xc, T2 yc ) noexcept
482  {
483  pcl::Rotate( x, y, angle, xc, yc );
484  }
485 
492  template <typename T1, typename T2>
493  void Rotate( T1 angle, const GenericPoint<T2>& center ) noexcept
494  {
495  Rotate( angle, center.x, center.y );
496  }
497 
505  template <typename T1, typename T2>
506  void Rotate( T1 sa, T1 ca, T2 xc, T2 yc ) noexcept
507  {
508  pcl::Rotate( x, y, sa, ca, xc, yc );
509  }
510 
518  template <typename T1, typename T2>
519  void Rotate( T1 sa, T1 ca, const GenericPoint<T2>& center ) noexcept
520  {
521  Rotate( sa, ca, center.x, center.y );
522  }
523 
531  template <typename T1, typename T2>
532  GenericPoint Rotated( T1 angle, T2 xc, T2 yc ) const noexcept
533  {
534  GenericPoint p( *this );
535  p.Rotate( angle, xc, yc );
536  return p;
537  }
538 
546  template <typename T1, typename T2>
547  GenericPoint Rotated( T1 angle, const GenericPoint<T2>& center ) const noexcept
548  {
549  GenericPoint p( *this );
550  p.Rotate( angle, center );
551  return p;
552  }
553 
562  template <typename T1, typename T2>
563  GenericPoint Rotated( T1 sa, T1 ca, T2 xc, T2 yc ) const noexcept
564  {
565  GenericPoint p( *this );
566  p.Rotate( sa, ca, xc, yc );
567  return p;
568  }
569 
578  template <typename T1, typename T2>
579  GenericPoint Rotated( T1 sa, T1 ca, const GenericPoint<T2>& center ) const noexcept
580  {
581  GenericPoint p( *this );
582  p.Rotate( sa, ca, center );
583  return p;
584  }
585 
592  void Round() noexcept
593  {
594  x = component( pcl::Round( double( x ) ) );
595  y = component( pcl::Round( double( y ) ) );
596  }
597 
603  void Round( int n ) noexcept
604  {
605  PCL_PRECONDITION( n >= 0 )
606  x = component( pcl::Round( double( x ), n ) );
607  y = component( pcl::Round( double( y ), n ) );
608  }
609 
616  GenericPoint Rounded() const noexcept
617  {
618  return GenericPoint( component( pcl::Round( double( x ) ) ), component( pcl::Round( double( y ) ) ) );
619  }
620 
627  GenericPoint Rounded( int n ) const noexcept
628  {
629  PCL_PRECONDITION( n >= 0 )
630  return GenericPoint( component( pcl::Round( double( x ), n ) ), component( pcl::Round( double( y ), n ) ) );
631  }
632 
640  {
641  return GenericPoint<int>( pcl::RoundInt( double( x ) ), pcl::RoundInt( double( y ) ) );
642  }
643 
651  void Truncate() noexcept
652  {
653  x = component( pcl::Trunc( double( x ) ) );
654  y = component( pcl::Trunc( double( y ) ) );
655  }
656 
664  GenericPoint Truncated() const noexcept
665  {
666  return GenericPoint( component( pcl::Trunc( double( x ) ) ), component( pcl::Trunc( double( y ) ) ) );
667  }
668 
677  {
678  return GenericPoint<int>( pcl::TruncInt( double( x ) ), pcl::TruncInt( double( y ) ) );
679  }
680 
689  template <typename T1>
690  GenericPoint& operator =( const GenericPoint<T1>& p ) noexcept
691  {
692  x = component( p.x );
693  y = component( p.y );
694  return *this;
695  }
696 
703  GenericPoint& operator =( component v ) noexcept
704  {
705  x = y = v;
706  return *this;
707  }
708 
709 #ifdef __PCL_QT_INTERFACE
710  GenericPoint& operator =( const QPoint& p ) noexcept
711  {
712  x = component( p.x() );
713  y = component( p.y() );
714  return *this;
715  }
716 #endif
717 
726  template <typename T1>
727  GenericPoint& operator +=( const GenericPoint<T1>& p ) noexcept
728  {
729  x += component( p.x );
730  y += component( p.y );
731  return *this;
732  }
733 
740  GenericPoint& operator +=( component d ) noexcept
741  {
742  x += d;
743  y += d;
744  return *this;
745  }
746 
747 #ifdef __PCL_QT_INTERFACE
748  GenericPoint& operator +=( const QPoint& p ) noexcept
749  {
750  x += component( p.x() );
751  y += component( p.y() );
752  return *this;
753  }
754 #endif
755 
764  template <typename T1>
765  GenericPoint& operator -=( const GenericPoint<T1>& p ) noexcept
766  {
767  x -= component( p.x );
768  y -= component( p.y );
769  return *this;
770  }
771 
778  GenericPoint& operator -=( component d ) noexcept
779  {
780  x -= d;
781  y -= d;
782  return *this;
783  }
784 
785 #ifdef __PCL_QT_INTERFACE
786  GenericPoint& operator -=( const QPoint& p ) noexcept
787  {
788  x -= component( p.x() );
789  y -= component( p.y() );
790  return *this;
791  }
792 #endif
793 
802  template <typename T1>
803  GenericPoint& operator *=( const GenericPoint<T1>& p ) noexcept
804  {
805  x *= component( p.x );
806  y *= component( p.y );
807  return *this;
808  }
809 
816  GenericPoint& operator *=( component d ) noexcept
817  {
818  x *= d;
819  y *= d;
820  return *this;
821  }
822 
823 #ifdef __PCL_QT_INTERFACE
824  GenericPoint& operator *=( const QPoint& p ) noexcept
825  {
826  x *= component( p.x() );
827  y *= component( p.y() );
828  return *this;
829  }
830 #endif
831 
840  template <typename T1>
841  GenericPoint& operator /=( const GenericPoint<T1>& p ) noexcept
842  {
843  PCL_PRECONDITION( component( p.x ) != component( 0 ) && component( p.y ) != component( 0 ) )
844  x /= component( p.x );
845  y /= component( p.y );
846  return *this;
847  }
848 
855  GenericPoint& operator /=( component d ) noexcept
856  {
857  PCL_PRECONDITION( d != component( 0 ) )
858  x /= d;
859  y /= d;
860  return *this;
861  }
862 
863 #ifdef __PCL_QT_INTERFACE
864  GenericPoint& operator /=( const QPoint& p ) noexcept
865  {
866  PCL_PRECONDITION( component( p.x() ) != component( 0 ) && component( p.y() ) != component( 0 ) )
867  x /= component( p.x() );
868  y /= component( p.y() );
869  return *this;
870  }
871 #endif
872 
876  GenericPoint operator +() const noexcept
877  {
878  return *this;
879  }
880 
886  GenericPoint operator -() const noexcept
887  {
888  return GenericPoint( -x, -y );
889  }
890 
895  void Reflect() noexcept
896  {
897  x = -x;
898  y = -y;
899  }
900 
905  void ReflectX() noexcept
906  {
907  y = -y;
908  }
909 
914  void ReflectY() noexcept
915  {
916  x = -x;
917  }
918 
923  GenericPoint Reflected() const noexcept
924  {
925  return GenericPoint( -x, -y );
926  }
927 
933  GenericPoint ReflectedX() const noexcept
934  {
935  return GenericPoint( x, -y );
936  }
937 
943  GenericPoint ReflectedY() const noexcept
944  {
945  return GenericPoint( -x, y );
946  }
947 
948  /*
949  * Returns a point whose coordinates are the coordinates of this point
950  * converted to radians, assuming that this point has coordinates expressed
951  * in degrees.
952  */
953  GenericPoint Rad() const noexcept
954  {
955  return GenericPoint( pcl::Rad( x ), pcl::Rad( y ) );
956  }
957 
963  GenericPoint Deg() const noexcept
964  {
965  return GenericPoint( pcl::Deg( x ), pcl::Deg( y ) );
966  }
967 
973  GenericPoint& ToRad() noexcept
974  {
975  x = pcl::Rad( x );
976  y = pcl::Rad( y );
977  return *this;
978  }
979 
985  GenericPoint& ToDeg() noexcept
986  {
987  x = pcl::Deg( x );
988  y = pcl::Deg( y );
989  return *this;
990  }
991 
997  component& operator []( int i ) noexcept
998  {
999  return (i == 0) ? x : y;
1000  }
1001 
1006  component operator []( int i ) const noexcept
1007  {
1008  return (i == 0) ? x : y;
1009  }
1010 
1017  template <typename T1, typename T2>
1018  double Dot( T1 px, T2 py ) const noexcept
1019  {
1020  return double( x )*double( px ) + double( y )*double( py );
1021  }
1022 
1028  template <typename T1>
1029  double Dot( const GenericPoint<T1>& p ) const noexcept
1030  {
1031  return Dot( p.x, p.y );
1032  }
1033 
1034 #ifdef __PCL_QT_INTERFACE
1035  operator QPoint() const noexcept
1036  {
1037  return QPoint( int( x ), int( y ) );
1038  }
1039 #endif
1040 };
1041 
1042 #undef PCL_ASSERT_POINT_SIZE
1043 
1044 // ----------------------------------------------------------------------------
1045 
1055 template <typename T1, typename T2> inline
1056 bool operator ==( const GenericPoint<T1>& p1, const GenericPoint<T2>& p2 ) noexcept
1057 {
1058  return p1.x == p2.x && p1.y == p2.y;
1059 }
1060 
1066 template <typename T> inline
1067 bool operator ==( const GenericPoint<T>& p1, T d2 ) noexcept
1068 {
1069  return p1.x == d2 && p1.y == d2;
1070 }
1071 
1077 template <typename T> inline
1078 bool operator ==( T d1, const GenericPoint<T>& p2 ) noexcept
1079 {
1080  return d1 == p2.x && d1 == p2.y;
1081 }
1082 
1093 template <typename T1, typename T2> inline
1094 bool operator <( const GenericPoint<T1>& p1, const GenericPoint<T2>& p2 ) noexcept
1095 {
1096  return p1.y < p2.y || p1.y == p2.y && p1.x < p2.x;
1097 }
1098 
1108 template <typename T> inline
1109 bool operator <( const GenericPoint<T>& p1, T d2 ) noexcept
1110 {
1111  return p1.y < d2 || p1.y == d2 && p1.x < d2;
1112 }
1113 
1123 template <typename T> inline
1124 bool operator <( T d1, const GenericPoint<T>& p2 ) noexcept
1125 {
1126  return d1 < p2.y || d1 == p2.y && d1 < p2.x;
1127 }
1128 
1140 template <typename T1, typename T2> inline
1142 {
1143  return GenericPoint<T1>( T1( p1.x + p2.x ), T1( p1.y + p2.y ) );
1144 }
1145 
1157 template <typename T> inline
1158 GenericPoint<T> operator +( const GenericPoint<T>& p1, T d2 ) noexcept
1159 {
1160  return GenericPoint<T>( p1.x+d2, p1.y+d2 );
1161 }
1162 
1171 template <typename T> inline
1172 GenericPoint<T> operator +( T d1, const GenericPoint<T>& p2 ) noexcept
1173 {
1174  return GenericPoint<T>( p2.x+d1, p2.y+d1 );
1175 }
1176 
1190 template <typename T1, typename T2> inline
1192 {
1193  return GenericPoint<T1>( T1( p1.x - p2.x ), T1( p1.y - p2.y ) );
1194 }
1195 
1208 template <typename T> inline
1209 GenericPoint<T> operator -( const GenericPoint<T>& p1, T d2 ) noexcept
1210 {
1211  return GenericPoint<T>( p1.x-d2, p1.y-d2 );
1212 }
1213 
1226 template <typename T> inline
1227 GenericPoint<T> operator -( T d1, const GenericPoint<T>& p2 ) noexcept
1228 {
1229  return GenericPoint<T>( d1-p2.x, d1-p2.y );
1230 }
1231 
1245 template <typename T1, typename T2> inline
1247 {
1248  return GenericPoint<T1>( T1( p1.x * p2.x ), T1( p1.y * p2.y ) );
1249 }
1250 
1263 template <typename T> inline
1264 GenericPoint<T> operator *( const GenericPoint<T>& p1, T d2 ) noexcept
1265 {
1266  return GenericPoint<T>( p1.x*d2, p1.y*d2 );
1267 }
1268 
1278 template <typename T> inline
1279 GenericPoint<T> operator *( T d1, const GenericPoint<T>& p2 ) noexcept
1280 {
1281  return GenericPoint<T>( p2.x*d1, p2.y*d1 );
1282 }
1283 
1295 template <typename T1, typename T2> inline
1297 {
1298  PCL_PRECONDITION( p2.x != T2( 0 ) && p2.y != T2( 0 ) )
1299  return GenericPoint<T1>( T1( p1.x / p2.x ), T1( p1.y / p2.y ) );
1300 }
1301 
1314 template <typename T> inline
1315 GenericPoint<T> operator /( const GenericPoint<T>& p1, T d2 ) noexcept
1316 {
1317  PCL_PRECONDITION( d2 != T( 0 ) )
1318  return GenericPoint<T>( p1.x/d2, p1.y/d2 );
1319 }
1320 
1333 template <typename T> inline
1334 GenericPoint<T> operator /( T d1, const GenericPoint<T>& p2 ) noexcept
1335 {
1336  PCL_PRECONDITION( p2.x != T( 0 ) && p2.y != T( 0 ) )
1337  return GenericPoint<T>( d1/p2.x, d1/p2.y );
1338 }
1339 
1344 // ### FIXME: We cannot use two template arguments here due to a conflict with
1345 // Distance( FI, FI ) defined in Iterator.h
1346 //template <typename T1, typename T2> inline
1347 template <typename T> inline
1348 double Distance( const GenericPoint<T>& p1, const GenericPoint<T>& p2 ) noexcept
1349 {
1350  double dx = double( p2.x ) - double( p1.x );
1351  double dy = double( p2.y ) - double( p1.y );
1352  return pcl::Sqrt( dx*dx + dy*dy );
1353 }
1354 
1360 template <typename T1, typename T2> inline
1361 double ManhattanDistance( const GenericPoint<T1>& p1, const GenericPoint<T2>& p2 ) noexcept
1362 {
1363  return Abs( double( p2.x ) - double( p1.x ) ) + Abs( double( p2.y ) - double( p1.y ) );
1364 }
1365 
1381 template <typename T, typename T1, typename T2> inline
1382 void Rotate( GenericPoint<T>& p, T1 a, T2 xc, T2 yc ) noexcept
1383 {
1384  pcl::Rotate( p.x, p.y, a, xc, yc );
1385 }
1386 
1402 template <typename T, typename T1, typename T2> inline
1403 void Rotate( GenericPoint<T>& p, T1 a, const GenericPoint<T2>& c ) noexcept
1404 {
1405  pcl::Rotate( p, a, c.x, c.y );
1406 }
1407 
1423 template <typename T, typename T1, typename T2> inline
1424 void Rotate( GenericPoint<T>& p, T1 sa, T1 ca, T2 xc, T2 yc ) noexcept
1425 {
1426  pcl::Rotate( p.x, p.y, sa, ca, xc, yc );
1427 }
1428 
1444 template <typename T, typename T1, typename T2> inline
1445 void Rotate( GenericPoint<T>& p, T1 sa, T1 ca, const GenericPoint<T2>& c ) noexcept
1446 {
1447  pcl::Rotate( p, sa, ca, c.x, c.y );
1448 }
1449 
1458 template <typename T> inline
1459 void Swap( GenericPoint<T>& p1, GenericPoint<T>& p2 ) noexcept
1460 {
1461  pcl::Swap( p1.x, p2.x );
1462  pcl::Swap( p1.y, p2.y );
1463 }
1464 
1465 // ----------------------------------------------------------------------------
1466 
1467 #ifndef __PCL_NO_POINT_INSTANTIATE
1468 
1480 using I32Point = GenericPoint<int32>;
1481 
1490 using Point = I32Point;
1491 
1499 using F32Point = GenericPoint<float>;
1500 
1509 using FPoint = F32Point;
1510 
1518 using F64Point = GenericPoint<double>;
1519 
1528 using DPoint = F64Point;
1529 
1530 #endif // !__PCL_NO_POINT_INSTANTIATE
1531 
1532 // ----------------------------------------------------------------------------
1533 
1534 } // pcl
1535 
1536 #endif // __PCL_Point_h
1537 
1538 // ----------------------------------------------------------------------------
1539 // EOF pcl/Point.h - Released 2024-06-18T15:48:54Z
64-bit floating-point point in the R^2 space.
32-bit floating-point point in the R^2 space.
64-bit floating-point point in the R^2 space.
32-bit floating-point point in the R^2 space.
A generic point in the two-dimensional space.
Definition: Point.h:100
void MoveBy(T1 dx, T2 dy) noexcept
Definition: Point.h:421
constexpr GenericPoint()
Definition: Point.h:118
void Truncate() noexcept
Definition: Point.h:651
double DistanceTo(const GenericPoint< T1 > &p) const noexcept
Definition: Point.h:250
GenericPoint< int > RoundedToInt() const noexcept
Definition: Point.h:639
GenericPoint< int > TruncatedToInt() const noexcept
Definition: Point.h:676
GenericPoint Rounded() const noexcept
Definition: Point.h:616
component x
Abscissa (horizontal, or X-axis coordinate).
Definition: Point.h:111
void Reflect() noexcept
Definition: Point.h:895
void Rotate(T1 sa, T1 ca, const GenericPoint< T2 > &center) noexcept
Definition: Point.h:519
double SquaredDistanceTo(const GenericPoint< T1 > &p) const noexcept
Definition: Point.h:231
GenericPoint ReflectedY() const noexcept
Definition: Point.h:943
GenericPoint & ToDeg() noexcept
Definition: Point.h:985
GenericPoint Reflected() const noexcept
Definition: Point.h:923
GenericPoint MovedTo(T1 xPos, T2 yPos) const noexcept
Definition: Point.h:379
GenericPoint MovedTo(const GenericPoint< T1 > &p) const noexcept
Definition: Point.h:368
double Dot(const GenericPoint< T1 > &p) const noexcept
Definition: Point.h:1029
GenericPoint(const GenericPoint< T1 > &p)
Definition: Point.h:200
double SquaredDistanceToOrigin() const noexcept
Definition: Point.h:269
GenericPoint Deg() const noexcept
Definition: Point.h:963
constexpr GenericPoint(component d)
Definition: Point.h:141
GenericPoint(std::initializer_list< T1 > l)
Definition: Point.h:173
void MoveTo(T1 xPos, T2 yPos) noexcept
Definition: Point.h:349
void ReflectX() noexcept
Definition: Point.h:905
GenericPoint Rotated(T1 sa, T1 ca, T2 xc, T2 yc) const noexcept
Definition: Point.h:563
GenericPoint Rounded(int n) const noexcept
Definition: Point.h:627
GenericPoint MovedBy(const GenericPoint< T1 > &d) const noexcept
Definition: Point.h:456
void Round() noexcept
Definition: Point.h:592
void Round(int n) noexcept
Definition: Point.h:603
GenericPoint & ToRad() noexcept
Definition: Point.h:973
double Dot(T1 px, T2 py) const noexcept
Definition: Point.h:1018
GenericPoint ReflectedX() const noexcept
Definition: Point.h:933
void MoveTo(const GenericPoint< T1 > &p) noexcept
Definition: Point.h:335
GenericPoint Rotated(T1 angle, const GenericPoint< T2 > &center) const noexcept
Definition: Point.h:547
double ManhattanDistanceTo(const GenericPoint< T1 > &p) const noexcept
Definition: Point.h:304
GenericPoint MovedBy(T1 dx, T2 dy) const noexcept
Definition: Point.h:468
void Rotate(T1 angle, const GenericPoint< T2 > &center) noexcept
Definition: Point.h:493
double ManhattanDistanceToOrigin() const noexcept
Definition: Point.h:322
component y
Ordinate (vertical, or Y-axis coordinate).
Definition: Point.h:112
GenericPoint Rotated(T1 sa, T1 ca, const GenericPoint< T2 > &center) const noexcept
Definition: Point.h:579
GenericPoint Truncated() const noexcept
Definition: Point.h:664
void MoveBy(const GenericPoint< T1 > &d) noexcept
Definition: Point.h:396
GenericPoint Rotated(T1 angle, T2 xc, T2 yc) const noexcept
Definition: Point.h:532
void MoveBy(T1 dxy) noexcept
Definition: Point.h:437
constexpr GenericPoint(T1 xPos, T2 yPos)
Definition: Point.h:130
void Rotate(T1 sa, T1 ca, T2 xc, T2 yc) noexcept
Definition: Point.h:506
void ReflectY() noexcept
Definition: Point.h:914
double DistanceToOrigin() const noexcept
Definition: Point.h:287
void Rotate(T1 angle, T2 xc, T2 yc) noexcept
Definition: Point.h:481
32-bit integer point on the plane.
32-bit integer point on the plane.
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Definition: Array.h:2267
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Definition: Array.h:2278
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:504
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:548
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:464
Complex< T1 > operator/(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
Definition: Complex.h:592
Complex< T > Sqrt(const Complex< T > &c) noexcept
Definition: Complex.h:674
T Abs(const Complex< T > &c) noexcept
Definition: Complex.h:429
Complex< T > Round(const Complex< T > &c) noexcept
Definition: Complex.h:938
void Rotate(T &x, T &y, T1 sa, T1 ca, T2 xc, T2 yc) noexcept
Definition: Math.h:2024
T Trunc(T x) noexcept
Definition: Math.h:1095
constexpr T Rad(T x) noexcept
Definition: Math.h:1894
int RoundInt(T x) noexcept
Definition: Math.h:1503
int TruncInt(T x) noexcept
Definition: Math.h:1132
constexpr T Deg(T x) noexcept
Definition: Math.h:606
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
Definition: Point.h:1459
double ManhattanDistance(const GenericPoint< T1 > &p1, const GenericPoint< T2 > &p2) noexcept
Definition: Point.h:1361
PCL root namespace.
Definition: AbstractImage.h:77
distance_type Distance(FI i, FI j)
Definition: Iterator.h:161