6 #define _USE_MATH_DEFINES
18 #define DEG2RAD M_PI/180.0
32 theta = fmod(t_init, 360.0);
39 setOrigin(x_init, y_init, t_init);
50 if (theta != other.theta) {
73 v1.
x = double(cell.
x) * this->m_resolution;
74 v1.
y = double(cell.
y) * this->m_resolution;
75 v1.
x = +v1.
x + m_origin.get_x() + 0 * this->m_resolution;
76 v1.
y = -v1.
y + m_origin.get_y() + (m_height - 1) * this->m_resolution;
80 v2.
x = v1.
x * m_origin.get_ca() - v1.
y * -m_origin.get_sa();
81 v2.
y = v1.
x * -m_origin.get_sa() + v1.
y * m_origin.get_ca();
90 world2.
x = world.
x * m_origin.get_ca() - world.
y * m_origin.get_sa();
91 world2.
y = world.
x * m_origin.get_sa() + world.
y * m_origin.get_ca();
92 int x = int((+world2.
x - this->m_origin.get_x()) / this->m_resolution) + 0;
93 int y = int((-world2.
y + this->m_origin.get_y()) / this->m_resolution) + m_height - 1;
95 c.
x = (x < 0) ? 0 : x;
96 c.
y = (y < 0) ? 0 : y;
97 c.
x = (c.
x >= m_width) ? m_width-1 : c.
x;
98 c.
y = (c.
y >= m_height) ? m_height-1 : c.
y;
107 world2.
x = world.
x * m_origin.get_ca() - world.
y * m_origin.get_sa();
108 world2.
y = world.
x * m_origin.get_sa() + world.
y * m_origin.get_ca();
110 c.
x = int((+world2.
x - this->m_origin.get_x()) / this->m_resolution) + 0;
111 c.
y = int((-world2.
y + this->m_origin.get_y()) / this->m_resolution) + m_height - 1;
117 XYCell cell = world2Cell_unsafeFast(world);
118 return isInsideMap(cell);
125 if (cell.
x >= m_width) {
128 if (cell.
y >= m_height) {
136 XYWorld wrld = cell2World(cell);
148 XYCell cell = world2Cell(wrld);
XYCell world2Cell(XYWorld world) const
bool isInsideMap(XYCell cell) const
Checks if a cell is inside the map.
XYWorld toXYWorld(yarp::dev::Nav2D::Map2DLocation loc) const
XYWorld cell2World(XYCell cell) const
yarp::dev::Nav2D::Map2DLocation toLocation(XYCell cell) const
XYCell toXYCell(yarp::dev::Nav2D::Map2DLocation loc) const
XYCell world2Cell_unsafeFast(XYWorld world) const
void setOrigin(double x_init, double y_init, double t_init)
bool operator!=(const MapGrid2DOrigin &other) const
yarp::math::Vec2D< double > XYWorld
An interface for the device drivers.
An interface to the operating system, including Port based communication.