Go to the documentation of this file.
62 #ifdef __PCL_QT_INTERFACE
63 # include <QtCore/QPoint>
79 #define PCL_ASSERT_POINT_SIZE() \
80 static_assert( sizeof( *this ) == 2*sizeof( T ), "Invalid sizeof( GenericPoint<> )" )
120 PCL_ASSERT_POINT_SIZE();
129 template <
typename T1,
typename T2>
134 PCL_ASSERT_POINT_SIZE();
144 PCL_ASSERT_POINT_SIZE();
172 template <
typename T1>
175 PCL_ASSERT_POINT_SIZE();
199 template <
typename T1>
203 PCL_ASSERT_POINT_SIZE();
206 #ifdef __PCL_QT_INTERFACE
210 PCL_ASSERT_POINT_SIZE();
230 template <
typename T1>
233 double dx = double( p.x ) - double( x );
234 double dy = double( p.y ) - double( y );
235 return dx*dx + dy*dy;
249 template <
typename T1>
252 return pcl::Sqrt( SquaredDistanceTo( p ) );
271 return double( x )*double( x ) + double( y )*double( y );
289 return pcl::Sqrt( SquaredDistanceToOrigin() );
303 template <
typename T1>
306 return Abs(
double( p.x ) -
double( x ) ) +
Abs(
double( p.y ) -
double( y ) );
324 return Abs(
double( x ) ) +
Abs(
double( y ) );
334 template <
typename T1>
348 template <
typename T1,
typename T2>
354 #ifdef __PCL_QT_INTERFACE
355 void MoveTo(
const QPoint& p ) noexcept
357 MoveTo( p.x(), p.y() );
367 template <
typename T1>
378 template <
typename T1,
typename T2>
395 template <
typename T1>
420 template <
typename T1,
typename T2>
436 template <
typename T1>
442 #ifdef __PCL_QT_INTERFACE
443 void MoveBy(
const QPoint& p )
445 MoveBy( p.x(), p.y() );
455 template <
typename T1>
467 template <
typename T1,
typename T2>
480 template <
typename T1,
typename T2>
481 void Rotate( T1 angle, T2 xc, T2 yc ) noexcept
492 template <
typename T1,
typename T2>
495 Rotate( angle, center.x, center.y );
505 template <
typename T1,
typename T2>
506 void Rotate( T1 sa, T1 ca, T2 xc, T2 yc ) noexcept
518 template <
typename T1,
typename T2>
521 Rotate( sa, ca, center.x, center.y );
531 template <
typename T1,
typename T2>
535 p.
Rotate( angle, xc, yc );
546 template <
typename T1,
typename T2>
550 p.
Rotate( angle, center );
562 template <
typename T1,
typename T2>
566 p.
Rotate( sa, ca, xc, yc );
578 template <
typename T1,
typename T2>
582 p.
Rotate( sa, ca, center );
605 PCL_PRECONDITION( n >= 0 )
629 PCL_PRECONDITION( n >= 0 )
689 template <
typename T1>
709 #ifdef __PCL_QT_INTERFACE
712 x = component( p.x() );
713 y = component( p.y() );
726 template <
typename T1>
747 #ifdef __PCL_QT_INTERFACE
750 x += component( p.x() );
751 y += component( p.y() );
764 template <
typename T1>
785 #ifdef __PCL_QT_INTERFACE
788 x -= component( p.x() );
789 y -= component( p.y() );
802 template <
typename T1>
823 #ifdef __PCL_QT_INTERFACE
826 x *= component( p.x() );
827 y *= component( p.y() );
840 template <
typename T1>
863 #ifdef __PCL_QT_INTERFACE
866 PCL_PRECONDITION( component( p.x() ) != component( 0 ) && component( p.y() ) != component( 0 ) )
867 x /= component( p.x() );
868 y /= component( p.y() );
999 return (i == 0) ? x : y;
1008 return (i == 0) ? x : y;
1017 template <
typename T1,
typename T2>
1018 double Dot( T1 px, T2 py )
const noexcept
1020 return double( x )*double( px ) + double( y )*double( py );
1028 template <
typename T1>
1031 return Dot( p.x, p.y );
1034 #ifdef __PCL_QT_INTERFACE
1035 operator QPoint() const noexcept
1037 return QPoint(
int( x ),
int( y ) );
1042 #undef PCL_ASSERT_POINT_SIZE
1055 template <
typename T1,
typename T2>
inline
1058 return p1.x == p2.x && p1.y == p2.y;
1066 template <
typename T>
inline
1069 return p1.x == d2 && p1.y == d2;
1077 template <
typename T>
inline
1080 return d1 == p2.x && d1 == p2.y;
1093 template <
typename T1,
typename T2>
inline
1096 return p1.y < p2.y || p1.y == p2.y && p1.x < p2.x;
1108 template <
typename T>
inline
1111 return p1.y < d2 || p1.y == d2 && p1.x < d2;
1123 template <
typename T>
inline
1126 return d1 < p2.y || d1 == p2.y && d1 < p2.x;
1140 template <
typename T1,
typename T2>
inline
1157 template <
typename T>
inline
1171 template <
typename T>
inline
1190 template <
typename T1,
typename T2>
inline
1208 template <
typename T>
inline
1226 template <
typename T>
inline
1245 template <
typename T1,
typename T2>
inline
1263 template <
typename T>
inline
1278 template <
typename T>
inline
1295 template <
typename T1,
typename T2>
inline
1298 PCL_PRECONDITION( p2.x != T2( 0 ) && p2.y != T2( 0 ) )
1314 template <
typename T>
inline
1317 PCL_PRECONDITION( d2 != T( 0 ) )
1333 template <
typename T>
inline
1336 PCL_PRECONDITION( p2.x != T( 0 ) && p2.y != T( 0 ) )
1347 template <
typename T>
inline
1350 double dx = double( p2.x ) - double( p1.x );
1351 double dy = double( p2.y ) - double( p1.y );
1360 template <
typename T1,
typename T2>
inline
1363 return Abs(
double( p2.x ) -
double( p1.x ) ) +
Abs(
double( p2.y ) -
double( p1.y ) );
1381 template <
typename T,
typename T1,
typename T2>
inline
1402 template <
typename T,
typename T1,
typename T2>
inline
1423 template <
typename T,
typename T1,
typename T2>
inline
1444 template <
typename T,
typename T1,
typename T2>
inline
1458 template <
typename T>
inline
1467 #ifndef __PCL_NO_POINT_INSTANTIATE
1480 using I32Point = GenericPoint<int32>;
1499 using F32Point = GenericPoint<float>;
1518 using F64Point = GenericPoint<double>;
1530 #endif // !__PCL_NO_POINT_INSTANTIATE
1536 #endif // __PCL_Point_h
double ManhattanDistanceTo(const GenericPoint< T1 > &p) const noexcept
void Rotate(T1 sa, T1 ca, const GenericPoint< T2 > ¢er) noexcept
double ManhattanDistanceToOrigin() const noexcept
distance_type Distance(FI i, FI j)
GenericPoint(std::initializer_list< T1 > l)
GenericPoint< int > TruncatedToInt() const noexcept
double Dot(T1 px, T2 py) const noexcept
GenericPoint Rounded() const noexcept
int RoundInt(T x) noexcept
A generic point in the two-dimensional space.
double DistanceTo(const GenericPoint< T1 > &p) const noexcept
bool operator==(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
Complex< T > Round(const Complex< T > &c) noexcept
32-bit integer point on the plane.
GenericPoint MovedBy(T1 dx, T2 dy) const noexcept
void MoveBy(T1 dx, T2 dy) noexcept
void MoveTo(T1 xPos, T2 yPos) noexcept
double ManhattanDistance(const GenericPoint< T1 > &p1, const GenericPoint< T2 > &p2) noexcept
void MoveBy(T1 dxy) noexcept
constexpr GenericPoint(component d)
void Rotate(T1 sa, T1 ca, T2 xc, T2 yc) noexcept
GenericPoint Rounded(int n) const noexcept
Complex< T1 > operator+(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
GenericPoint Reflected() const noexcept
GenericPoint Rotated(T1 angle, T2 xc, T2 yc) const noexcept
64-bit floating-point point in the R^2 space.
32-bit floating-point point in the R^2 space.
void Round(int n) noexcept
32-bit floating-point point in the R^2 space.
GenericPoint Rotated(T1 sa, T1 ca, T2 xc, T2 yc) const noexcept
Complex< T > Sqrt(const Complex< T > &c) noexcept
constexpr GenericPoint(T1 xPos, T2 yPos)
void Rotate(T1 angle, const GenericPoint< T2 > ¢er) noexcept
Complex< T1 > operator-(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
double SquaredDistanceToOrigin() const noexcept
double SquaredDistanceTo(const GenericPoint< T1 > &p) const noexcept
GenericPoint Deg() const noexcept
GenericPoint(const GenericPoint< T1 > &p)
void MoveTo(const GenericPoint< T1 > &p) noexcept
component x
Abscissa (horizontal, or X-axis coordinate).
GenericPoint MovedTo(const GenericPoint< T1 > &p) const noexcept
GenericPoint ReflectedY() const noexcept
double DistanceToOrigin() const noexcept
constexpr T Deg(T x) noexcept
Complex< T1 > operator/(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
GenericPoint & ToRad() noexcept
void Swap(GenericPoint< T > &p1, GenericPoint< T > &p2) noexcept
GenericPoint ReflectedX() const noexcept
Complex< T1 > operator*(const Complex< T1 > &c1, const Complex< T2 > &c2) noexcept
GenericPoint< int > RoundedToInt() const noexcept
int TruncInt(T x) noexcept
component y
Ordinate (vertical, or Y-axis coordinate).
void MoveBy(const GenericPoint< T1 > &d) noexcept
constexpr T Rad(T x) noexcept
GenericPoint Truncated() const noexcept
GenericPoint & ToDeg() noexcept
64-bit floating-point point in the R^2 space.
T Abs(const Complex< T > &c) noexcept
GenericPoint Rotated(T1 angle, const GenericPoint< T2 > ¢er) const noexcept
GenericPoint MovedBy(const GenericPoint< T1 > &d) const noexcept
GenericPoint Rotated(T1 sa, T1 ca, const GenericPoint< T2 > ¢er) const noexcept
GenericPoint MovedTo(T1 xPos, T2 yPos) const noexcept
void Rotate(T1 angle, T2 xc, T2 yc) noexcept
double Dot(const GenericPoint< T1 > &p) const noexcept
32-bit integer point on the plane.
bool operator<(const Array< T, A > &x1, const Array< T, A > &x2) noexcept
void Rotate(T &x, T &y, T1 sa, T1 ca, T2 xc, T2 yc) noexcept