MRPT  2.0.3
TPoint2D.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "math-precomp.h" // Precompiled headers
11 
12 #include <mrpt/math/TPoint2D.h>
13 #include <mrpt/math/TPoint3D.h>
14 #include <mrpt/math/TPose2D.h>
15 #include <mrpt/math/TPose3D.h>
16 
17 namespace mrpt::math
18 {
19 static_assert(std::is_trivial_v<TPoint2D_data<float>>);
20 static_assert(std::is_trivial_v<TPoint2D_data<double>>);
21 static_assert(std::is_trivially_copyable_v<TPoint2D>);
22 static_assert(std::is_trivially_copyable_v<TPoint2Df>);
23 
24 template <typename T>
26  : TPoint2D_data<T>{static_cast<T>(p.x), static_cast<T>(p.y)}
27 {
28 }
29 
30 template <typename T>
32 {
33 }
34 
35 template <typename T>
37  : TPoint2D_data<T>{static_cast<T>(p.x), static_cast<T>(p.y)}
38 {
39 }
40 
41 template <typename T>
43 {
44  if (this->x < p.x)
45  return true;
46  else if (this->x > p.x)
47  return false;
48  else
49  return this->y < p.y;
50 }
51 
52 template <typename T>
53 void TPoint2D_<T>::fromString(const std::string& s)
54 {
56  if (!m.fromMatlabStringFormat(s))
57  THROW_EXCEPTION("Malformed expression in ::fromString");
58  ASSERTMSG_(
59  m.rows() == 1 && m.cols() == 2, "Wrong size of vector in ::fromString");
60  this->x = m(0, 0);
61  this->y = m(0, 1);
62 }
63 
64 // Explicit instantiations:
65 template struct TPoint2D_<float>;
66 template struct TPoint2D_<double>;
67 } // namespace mrpt::math
mrpt::math::TPoint3D_
Base template for TPoint3D and TPoint3Df.
Definition: TPoint3D.h:37
TPoint2D.h
mrpt::math::MatrixVectorBase< T, CMatrixDynamic< T > >::fromMatlabStringFormat
bool fromMatlabStringFormat(const std::string &s, mrpt::optional_ref< std::ostream > dump_errors_here=std::nullopt)
Reads a matrix from a string in Matlab-like format, for example: "[1 0 2; 0 4 -1]" The string must st...
Definition: MatrixVectorBase_impl.h:24
mrpt::math::TPoint2D_
Base template for TPoint2D and TPoint2Df.
Definition: TPoint2D.h:32
math-precomp.h
TPose2D.h
mrpt::math::TPose2D::y
double y
Definition: TPose2D.h:30
mrpt::math::TPose3D::y
double y
Definition: TPose3D.h:32
THROW_EXCEPTION
#define THROW_EXCEPTION(msg)
Definition: exceptions.h:67
mrpt::maps::operator<
bool operator<(const COccupancyGridMap2D::TPairLikelihoodIndex &e1, const COccupancyGridMap2D::TPairLikelihoodIndex &e2)
Definition: COccupancyGridMap2D_common.cpp:731
TPose3D.h
mrpt::math::TPose2D
Lightweight 2D pose.
Definition: TPose2D.h:22
mrpt::math::TPose3D::x
double x
X,Y,Z, coords.
Definition: TPose3D.h:32
mrpt::math::TPose3D
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Definition: TPose3D.h:24
mrpt::math::TPoint2D_data::y
T y
Definition: TPoint2D.h:25
ASSERTMSG_
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
Definition: exceptions.h:108
mrpt::math::TPoint3D_data::y
T y
Definition: TPoint3D.h:29
mrpt::math::TPoint2D_data
Definition: TPoint2D.h:22
mrpt::math::TPoint2D_data::x
T x
X,Y coordinates.
Definition: TPoint2D.h:25
mrpt::math::TPoint2D_::TPoint2D_
constexpr TPoint2D_()
Default constructor.
Definition: TPoint2D.h:41
TPoint3D.h
mrpt::math::TPoint3D_data::x
T x
X,Y,Z coordinates.
Definition: TPoint3D.h:29
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:11
mrpt::math::CMatrixDynamic::cols
size_type cols() const
Number of columns in the matrix.
Definition: CMatrixDynamic.h:340
mrpt::math::CMatrixDynamic
This template class provides the basic functionality for a general 2D any-size, resizable container o...
Definition: CMatrixDynamic.h:39
mrpt::math::CMatrixDynamic::rows
size_type rows() const
Number of rows in the matrix.
Definition: CMatrixDynamic.h:337
mrpt::math::TPose2D::x
double x
X,Y coordinates.
Definition: TPose2D.h:30



Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 15 23:51:15 UTC 2020