PCL
Point.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 02.01.12.0947
6 // ----------------------------------------------------------------------------
7 // pcl/Point.h - Released 2019-04-30T16:30:41Z
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-2019 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 (http://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  typedef T component;
107 
108  /*
109  * Point coordinates
110  */
111  component x;
112  component y;
113 
118  constexpr GenericPoint()
119  {
120  PCL_ASSERT_POINT_SIZE();
121  }
122 
130  template <typename T1>
131  constexpr GenericPoint( T1 xPos, T1 yPos ) :
132  x( component( xPos ) ), y( component( yPos ) )
133  {
134  PCL_ASSERT_POINT_SIZE();
135  }
136 
141  constexpr GenericPoint( component d ) : GenericPoint( d, d )
142  {
143  PCL_ASSERT_POINT_SIZE();
144  }
145 
169  template <typename T1>
170  GenericPoint( std::initializer_list<T1> l )
171  {
172  PCL_ASSERT_POINT_SIZE();
173  switch ( l.size() )
174  {
175  default:
176  case 2: y = component( l.begin()[1] );
177  case 1: x = component( l.begin()[0] );
178  case 0: break;
179  }
180  switch ( l.size() )
181  {
182  case 0: x = component( 0 );
183  case 1: y = component( 0 );
184  default:
185  case 2: break;
186  }
187  }
188 
194  template <typename T1>
196  GenericPoint( component( p.x ), component( p.y ) )
197  {
198  PCL_ASSERT_POINT_SIZE();
199  }
200 
201 #ifdef __PCL_QT_INTERFACE
202  GenericPoint( const QPoint& p ) :
203  GenericPoint( component( p.x() ), component( p.y() ) )
204  {
205  PCL_ASSERT_POINT_SIZE();
206  }
207 #endif
208 
223  template <typename T1>
224  double SquaredDistanceTo( const GenericPoint<T1>& p ) const
225  {
226  double dx = double( p.x ) - double( x );
227  double dy = double( p.y ) - double( y );
228  return dx*dx + dy*dy;
229  }
230 
240  template <typename T1>
241  double DistanceTo( const GenericPoint<T1>& p ) const
242  {
243  return pcl::Sqrt( SquaredDistanceTo( p ) );
244  }
245 
255  template <typename T1>
256  double ManhattanDistanceTo( const GenericPoint<T1>& p ) const
257  {
258  return Abs( double( p.x ) - double( x ) ) + Abs( double( p.y ) - double( y ) );
259  }
260 
266  template <typename T1>
267  void MoveTo( const GenericPoint<T1>& p )
268  {
269  MoveTo( p.x, p.y );
270  }
271 
278  template <typename T1>
279  void MoveTo( T1 xPos, T1 yPos )
280  {
281  x = component( xPos ); y = component( yPos );
282  }
283 
284 #ifdef __PCL_QT_INTERFACE
285  void MoveTo( const QPoint& p )
286  {
287  MoveTo( p.x(), p.y() );
288  }
289 #endif
290 
295  template <typename T1>
297  {
298  return GenericPoint( component( p.x ), component( p.y ) );
299  }
300 
304  template <typename T1>
305  GenericPoint MovedTo( T1 xPos, T1 yPos ) const
306  {
307  return GenericPoint( component( xPos ), component( yPos ) );
308  }
309 
319  template <typename T1>
320  void MoveBy( const GenericPoint<T1>& d )
321  {
322  MoveBy( d.x, d.y );
323  }
324 
342  template <typename T1>
343  void MoveBy( T1 dx, T1 dy )
344  {
345  x += component( dx ); y += component( dy );
346  }
347 
358  template <typename T1>
359  void MoveBy( T1 dxy )
360  {
361  x += component( dxy ); y += component( dxy );
362  }
363 
364 #ifdef __PCL_QT_INTERFACE
365  void MoveBy( const QPoint& p )
366  {
367  MoveBy( p.x(), p.y() );
368  }
369 #endif
370 
375  template <typename T1>
377  {
378  return GenericPoint( x + component( d.x ), y + component( d.y ) );
379  }
380 
385  template <typename T1>
386  GenericPoint MovedBy( T1 dx, T1 dy ) const
387  {
388  return GenericPoint( x + component( dx ), y + component( dy ) );
389  }
390 
396  template <typename T1, typename T2>
397  void Rotate( T1 angle, T2 xc, T2 yc )
398  {
399  pcl::Rotate( x, y, angle, xc, yc );
400  }
401 
406  template <typename T1, typename T2>
407  void Rotate( T1 angle, const GenericPoint<T2>& center )
408  {
409  Rotate( angle, center.x, center.y );
410  }
411 
417  template <typename T1, typename T2>
418  void Rotate( T1 sa, T1 ca, T2 xc, T2 yc )
419  {
420  pcl::Rotate( x, y, sa, ca, xc, yc );
421  }
422 
428  template <typename T1, typename T2>
429  void Rotate( T1 sa, T1 ca, const GenericPoint<T2>& center )
430  {
431  Rotate( sa, ca, center.x, center.y );
432  }
433 
439  template <typename T1, typename T2>
440  GenericPoint Rotated( T1 angle, T2 xc, T2 yc ) const
441  {
442  GenericPoint p( *this );
443  p.Rotate( angle, xc, yc );
444  return p;
445  }
446 
452  template <typename T1, typename T2>
453  GenericPoint Rotated( T1 angle, const GenericPoint<T2>& center ) const
454  {
455  GenericPoint p( *this );
456  p.Rotate( angle, center );
457  return p;
458  }
459 
466  template <typename T1, typename T2>
467  GenericPoint Rotated( T1 sa, T1 ca, T2 xc, T2 yc ) const
468  {
469  GenericPoint p( *this );
470  p.Rotate( sa, ca, xc, yc );
471  return p;
472  }
473 
480  template <typename T1, typename T2>
481  GenericPoint Rotated( T1 sa, T1 ca, const GenericPoint<T2>& center ) const
482  {
483  GenericPoint p( *this );
484  p.Rotate( sa, ca, center );
485  return p;
486  }
487 
494  void Round()
495  {
496  x = component( pcl::Round( double( x ) ) );
497  y = component( pcl::Round( double( y ) ) );
498  }
499 
505  void Round( int n )
506  {
507  PCL_PRECONDITION( n >= 0 )
508  x = component( pcl::Round( double( x ), n ) );
509  y = component( pcl::Round( double( y ), n ) );
510  }
511 
519  {
520  return GenericPoint( component( pcl::Round( double( x ) ) ), component( pcl::Round( double( y ) ) ) );
521  }
522 
529  GenericPoint Rounded( int n ) const
530  {
531  PCL_PRECONDITION( n >= 0 )
532  return GenericPoint( component( pcl::Round( double( x ), n ) ), component( pcl::Round( double( y ), n ) ) );
533  }
534 
542  {
543  return GenericPoint<int>( pcl::RoundInt( double( x ) ), pcl::RoundInt( double( y ) ) );
544  }
545 
553  void Truncate()
554  {
555  x = component( pcl::Trunc( double( x ) ) );
556  y = component( pcl::Trunc( double( y ) ) );
557  }
558 
567  {
568  return GenericPoint( component( pcl::Trunc( double( x ) ) ), component( pcl::Trunc( double( y ) ) ) );
569  }
570 
579  {
580  return GenericPoint<int>( pcl::TruncInt( double( x ) ), pcl::TruncInt( double( y ) ) );
581  }
582 
589  template <typename T1>
590  GenericPoint& operator =( const GenericPoint<T1>& p )
591  {
592  x = component( p.x );
593  y = component( p.y );
594  return *this;
595  }
596 
603  GenericPoint& operator =( component v )
604  {
605  x = y = v;
606  return *this;
607  }
608 
609 #ifdef __PCL_QT_INTERFACE
610  GenericPoint& operator =( const QPoint& p )
611  {
612  x = component( p.x() );
613  y = component( p.y() );
614  return *this;
615  }
616 #endif
617 
624  template <typename T1>
625  GenericPoint& operator +=( const GenericPoint<T1>& p )
626  {
627  x += component( p.x );
628  y += component( p.y );
629  return *this;
630  }
631 
638  GenericPoint& operator +=( component d )
639  {
640  x += d;
641  y += d;
642  return *this;
643  }
644 
645 #ifdef __PCL_QT_INTERFACE
646  GenericPoint& operator +=( const QPoint& p )
647  {
648  x += component( p.x() );
649  y += component( p.y() );
650  return *this;
651  }
652 #endif
653 
660  template <typename T1>
661  GenericPoint& operator -=( const GenericPoint<T1>& p )
662  {
663  x -= component( p.x );
664  y -= component( p.y );
665  return *this;
666  }
667 
674  GenericPoint& operator -=( component d )
675  {
676  x -= d;
677  y -= d;
678  return *this;
679  }
680 
681 #ifdef __PCL_QT_INTERFACE
682  GenericPoint& operator -=( const QPoint& p )
683  {
684  x -= component( p.x() );
685  y -= component( p.y() );
686  return *this;
687  }
688 #endif
689 
696  template <typename T1>
697  GenericPoint& operator *=( const GenericPoint<T1>& p )
698  {
699  x *= component( p.x );
700  y *= component( p.y );
701  return *this;
702  }
703 
710  GenericPoint& operator *=( component d )
711  {
712  x *= d;
713  y *= d;
714  return *this;
715  }
716 
717 #ifdef __PCL_QT_INTERFACE
718  GenericPoint& operator *=( const QPoint& p )
719  {
720  x *= component( p.x() );
721  y *= component( p.y() );
722  return *this;
723  }
724 #endif
725 
732  template <typename T1>
733  GenericPoint& operator /=( const GenericPoint<T1>& p )
734  {
735  PCL_PRECONDITION( component( p.x ) != component( 0 ) && component( p.y ) != component( 0 ) )
736  x /= component( p.x );
737  y /= component( p.y );
738  return *this;
739  }
740 
747  GenericPoint& operator /=( component d )
748  {
749  PCL_PRECONDITION( d != component( 0 ) )
750  x /= d;
751  y /= d;
752  return *this;
753  }
754 
755 #ifdef __PCL_QT_INTERFACE
756  GenericPoint& operator /=( const QPoint& p )
757  {
758  PCL_PRECONDITION( component( p.x() ) != component( 0 ) && component( p.y() ) != component( 0 ) )
759  x /= component( p.x() );
760  y /= component( p.y() );
761  return *this;
762  }
763 #endif
764 
769  {
770  return *this;
771  }
772 
779  {
780  return GenericPoint( -x, -y );
781  }
782 
783  /*
784  * Returns a point whose coordinates are the coordinates of this point
785  * converted to radians, assuming that this point has coordinates expressed
786  * in degrees.
787  */
788  GenericPoint Rad() const
789  {
790  return GenericPoint( pcl::Rad( x ), pcl::Rad( y ) );
791  }
792 
799  {
800  return GenericPoint( pcl::Deg( x ), pcl::Deg( y ) );
801  }
802 
809  {
810  x = pcl::Rad( x );
811  y = pcl::Rad( y );
812  return *this;
813  }
814 
821  {
822  x = pcl::Deg( x );
823  y = pcl::Deg( y );
824  return *this;
825  }
826 
832  component& operator []( int i )
833  {
834  return (i == 0) ? x : y;
835  }
836 
841  component operator []( int i ) const
842  {
843  return (i == 0) ? x : y;
844  }
845 
850  template <typename T1, typename T2>
851  double Dot( T1 px, T2 py ) const
852  {
853  return double( x )*double( px ) + double( y )*double( py );
854  }
855 
859  template <typename T1>
860  double Dot( const GenericPoint<T1>& p ) const
861  {
862  return Dot( p.x, p.y );
863  }
864 
865 #ifdef __PCL_QT_INTERFACE
866  operator QPoint() const
867  {
868  return QPoint( int( x ), int( y ) );
869  }
870 #endif
871 };
872 
873 #undef PCL_ASSERT_POINT_SIZE
874 
875 // ----------------------------------------------------------------------------
876 
886 template <typename T1, typename T2> inline
887 bool operator ==( const GenericPoint<T1>& p1, const GenericPoint<T2>& p2 )
888 {
889  return p1.x == p2.x && p1.y == p2.y;
890 }
891 
897 template <typename T> inline
898 bool operator ==( const GenericPoint<T>& p1, T d2 )
899 {
900  return p1.x == d2 && p1.y == d2;
901 }
902 
908 template <typename T> inline
909 bool operator ==( T d1, const GenericPoint<T>& p2 )
910 {
911  return d1 == p2.x && d1 == p2.y;
912 }
913 
924 template <typename T1, typename T2> inline
925 bool operator <( const GenericPoint<T1>& p1, const GenericPoint<T2>& p2 )
926 {
927  return p1.y < p2.y || p1.y == p2.y && p1.x < p2.x;
928 }
929 
939 template <typename T> inline
940 bool operator <( const GenericPoint<T>& p1, T d2 )
941 {
942  return p1.y < d2 || p1.y == d2 && p1.x < d2;
943 }
944 
954 template <typename T> inline
955 bool operator <( T d1, const GenericPoint<T>& p2 )
956 {
957  return d1 < p2.y || d1 == p2.y && d1 < p2.x;
958 }
959 
971 template <typename T1, typename T2> inline
973 {
974  return GenericPoint<T1>( T1( p1.x + p2.x ), T1( p1.y + p2.y ) );
975 }
976 
988 template <typename T> inline
990 {
991  return GenericPoint<T>( p1.x+d2, p1.y+d2 );
992 }
993 
1002 template <typename T> inline
1004 {
1005  return GenericPoint<T>( p2.x+d1, p2.y+d1 );
1006 }
1007 
1021 template <typename T1, typename T2> inline
1023 {
1024  return GenericPoint<T1>( T1( p1.x - p2.x ), T1( p1.y - p2.y ) );
1025 }
1026 
1039 template <typename T> inline
1041 {
1042  return GenericPoint<T>( p1.x-d2, p1.y-d2 );
1043 }
1044 
1057 template <typename T> inline
1059 {
1060  return GenericPoint<T>( d1-p2.x, d1-p2.y );
1061 }
1062 
1076 template <typename T1, typename T2> inline
1078 {
1079  return GenericPoint<T1>( T1( p1.x * p2.x ), T1( p1.y * p2.y ) );
1080 }
1081 
1094 template <typename T> inline
1096 {
1097  return GenericPoint<T>( p1.x*d2, p1.y*d2 );
1098 }
1099 
1109 template <typename T> inline
1111 {
1112  return GenericPoint<T>( p2.x*d1, p2.y*d1 );
1113 }
1114 
1126 template <typename T1, typename T2> inline
1128 {
1129  PCL_PRECONDITION( p2.x != T2( 0 ) && p2.y != T2( 0 ) )
1130  return GenericPoint<T1>( T1( p1.x / p2.x ), T1( p1.y / p2.y ) );
1131 }
1132 
1145 template <typename T> inline
1147 {
1148  PCL_PRECONDITION( d2 != T( 0 ) )
1149  return GenericPoint<T>( p1.x/d2, p1.y/d2 );
1150 }
1151 
1164 template <typename T> inline
1166 {
1167  PCL_PRECONDITION( p2.x != T( 0 ) && p2.y != T( 0 ) )
1168  return GenericPoint<T>( d1/p2.x, d1/p2.y );
1169 }
1170 
1175 // ### FIXME: We cannot use two template arguments here due to a conflict with
1176 // Distance( FI, FI ) defined in Iterator.h
1177 //template <typename T1, typename T2> inline
1178 template <typename T> inline
1179 double Distance( const GenericPoint<T>& p1, const GenericPoint<T>& p2 )
1180 {
1181  double dx = double( p2.x ) - double( p1.x );
1182  double dy = double( p2.y ) - double( p1.y );
1183  return pcl::Sqrt( dx*dx + dy*dy );
1184 }
1185 
1191 template <typename T1, typename T2> inline
1193 {
1194  return Abs( double( p2.x ) - double( p1.x ) ) + Abs( double( p2.y ) - double( p1.y ) );
1195 }
1196 
1212 template <typename T, typename T1, typename T2> inline
1213 void Rotate( GenericPoint<T>& p, T1 a, T2 xc, T2 yc )
1214 {
1215  pcl::Rotate( p.x, p.y, a, xc, yc );
1216 }
1217 
1233 template <typename T, typename T1, typename T2> inline
1234 void Rotate( GenericPoint<T>& p, T1 a, const GenericPoint<T2>& c )
1235 {
1236  pcl::Rotate( p, a, c.x, c.y );
1237 }
1238 
1254 template <typename T, typename T1, typename T2> inline
1255 void Rotate( GenericPoint<T>& p, T1 sa, T1 ca, T2 xc, T2 yc )
1256 {
1257  pcl::Rotate( p.x, p.y, sa, ca, xc, yc );
1258 }
1259 
1275 template <typename T, typename T1, typename T2> inline
1276 void Rotate( GenericPoint<T>& p, T1 sa, T1 ca, const GenericPoint<T2>& c )
1277 {
1278  pcl::Rotate( p, sa, ca, c.x, c.y );
1279 }
1280 
1289 template <typename T> inline
1291 {
1292  pcl::Swap( p1.x, p2.x );
1293  pcl::Swap( p1.y, p2.y );
1294 }
1295 
1296 // ----------------------------------------------------------------------------
1297 
1298 #ifndef __PCL_NO_POINT_INSTANTIATE
1299 
1312 
1321 typedef I32Point Point;
1322 
1331 
1340 typedef F32Point FPoint;
1341 
1350 
1359 typedef F64Point DPoint;
1360 
1361 #endif // !__PCL_NO_POINT_INSTANTIATE
1362 
1363 // ----------------------------------------------------------------------------
1364 
1365 } // pcl
1366 
1367 #endif // __PCL_Point_h
1368 
1369 // ----------------------------------------------------------------------------
1370 // EOF pcl/Point.h - Released 2019-04-30T16:30:41Z
distance_type Distance(FI i, FI j)
Definition: Iterator.h:161
double DistanceTo(const GenericPoint< T1 > &p) const
Definition: Point.h:241
64-bit floating-point point in the R^2 space.
GenericPoint Rotated(T1 sa, T1 ca, const GenericPoint< T2 > &center) const
Definition: Point.h:481
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:539
A generic point in the two-dimensional space.
Definition: Point.h:99
constexpr GenericPoint()
Definition: Point.h:118
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:455
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2)
Definition: Point.h:1290
GenericPoint Rounded(int n) const
Definition: Point.h:529
int RoundInt(T x)
Definition: Math.h:1374
void Rotate(T1 angle, T2 xc, T2 yc)
Definition: Point.h:397
void Truncate()
Definition: Point.h:553
GenericPoint MovedBy(const GenericPoint< T1 > &d) const
Definition: Point.h:376
PCL root namespace.
Definition: AbstractImage.h:76
GenericPoint< int > TruncatedToInt() const
Definition: Point.h:578
Complex< T > Sqrt(const Complex< T > &c)
Definition: Complex.h:665
GenericPoint Deg() const
Definition: Point.h:798
Complex< T > Round(const Complex< T > &c)
Definition: Complex.h:929
void MoveTo(T1 xPos, T1 yPos)
Definition: Point.h:279
constexpr T Rad(T x)
Definition: Math.h:1705
void Round(int n)
Definition: Point.h:505
double Dot(T1 px, T2 py) const
Definition: Point.h:851
void MoveBy(T1 dxy)
Definition: Point.h:359
GenericPoint Rotated(T1 angle, const GenericPoint< T2 > &center) const
Definition: Point.h:453
32-bit integer point on the plane.
void Rotate(T1 angle, const GenericPoint< T2 > &center)
Definition: Point.h:407
double ManhattanDistance(const GenericPoint< T1 > &p1, const GenericPoint< T2 > &p2)
Definition: Point.h:1192
constexpr GenericPoint(T1 xPos, T1 yPos)
Definition: Point.h:131
void MoveBy(const GenericPoint< T1 > &d)
Definition: Point.h:320
void Rotate(T1 sa, T1 ca, T2 xc, T2 yc)
Definition: Point.h:418
GenericPoint Truncated() const
Definition: Point.h:566
GenericPoint MovedTo(T1 xPos, T1 yPos) const
Definition: Point.h:305
GenericPoint MovedBy(T1 dx, T1 dy) const
Definition: Point.h:386
T Abs(const Complex< T > &c)
Definition: Complex.h:420
component x
Abscissa (horizontal, or X-axis coordinate).
Definition: Point.h:111
GenericPoint MovedTo(const GenericPoint< T1 > &p) const
Definition: Point.h:296
int TruncInt(T x)
Definition: Math.h:1012
void Rotate(T &x, T &y, T1 sa, T1 ca, T2 xc, T2 yc)
Definition: Math.h:1823
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:495
void MoveTo(const GenericPoint< T1 > &p)
Definition: Point.h:267
constexpr GenericPoint(component d)
Definition: Point.h:141
void Round()
Definition: Point.h:494
GenericPoint Rounded() const
Definition: Point.h:518
32-bit floating-point point in the R^2 space.
double ManhattanDistanceTo(const GenericPoint< T1 > &p) const
Definition: Point.h:256
double SquaredDistanceTo(const GenericPoint< T1 > &p) const
Definition: Point.h:224
GenericPoint< int > RoundedToInt() const
Definition: Point.h:541
void Rotate(T1 sa, T1 ca, const GenericPoint< T2 > &center)
Definition: Point.h:429
constexpr T Deg(T x)
Definition: Math.h:561
GenericPoint(const GenericPoint< T1 > &p)
Definition: Point.h:195
64-bit floating-point point in the R^2 space.
GenericPoint Rotated(T1 sa, T1 ca, T2 xc, T2 yc) const
Definition: Point.h:467
GenericPoint(std::initializer_list< T1 > l)
Definition: Point.h:170
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2)
Definition: Array.h:2075
Complex< T1 > operator/(const Complex< T1 > &c1, const Complex< T2 > &c2)
Definition: Complex.h:583
GenericPoint & ToDeg()
Definition: Point.h:820
32-bit integer point on the plane.
double Dot(const GenericPoint< T1 > &p) const
Definition: Point.h:860
GenericPoint Rotated(T1 angle, T2 xc, T2 yc) const
Definition: Point.h:440
32-bit floating-point point in the R^2 space.
component y
Ordinate (vertical, or Y-axis coordinate).
Definition: Point.h:112
T Trunc(T x)
Definition: Math.h:980
GenericPoint & ToRad()
Definition: Point.h:808
void MoveBy(T1 dx, T1 dy)
Definition: Point.h:343