29 for (
i = 0,
j = points.size() - 1;
i < points.size();
j =
i++)
32 (
testx < (points[
j].x - points[
i].x) * (
testy - points[
i].y) / (points[
j].y - points[
i].y) + points[
i].x))
56 if (
it->map_id != map_name)
60 yError() <<
"all area_points must belong to the same map:" << map_name;
144 cent.
x = (
rb.x -
lt.x) / 2.0;
154 lt.
x =
lt.y = std::numeric_limits<double>::max();
155 rb.x =
rb.y = std::numeric_limits<double>::min();
177 std::random_device
rd;
178 std::mt19937
gen(
rd());
179 std::uniform_real_distribution<double>
dis_x(
lt.x,
rb.x);
180 std::uniform_real_distribution<double>
dis_y(
lt.y,
rb.y);
200 yError() <<
"Problem found in Map2DArea::getRandomLocation()";
int pnpoly(std::vector< yarp::math::Vec2D< double > > points, double testx, double testy)
contains the definition of a Map2DArea type
std::string description
user defined string
std::string map_id
name of the map
std::vector< yarp::math::Vec2D< double > > points
list of points which define the vertices of the area
std::string map_id
name of the map
double theta
orientation [deg] in the map reference frame
double y
y position of the location [m], expressed in the map reference frame
double x
x position of the location [m], expressed in the map reference frame
void clear()
Remove all elements from the path.
std::string toString() const
Returns text representation of the area.
bool operator==(const Map2DArea &r) const
Compares two Map2DArea.
bool operator!=(const Map2DArea &r) const
Compares two Map2DAreas.
Map2DArea()
Default constructor: the map name is empty, coordinates are set to zero.
bool getRandomLocation(yarp::dev::Nav2D::Map2DLocation &loc)
get a random Map2DLocation inside the Map2DArea @loc the computed Map2DLocation
bool findAreaBounds(yarp::dev::Nav2D::Map2DLocation <, yarp::dev::Nav2D::Map2DLocation &rb)
retrieves two Map2DLocations representing the bounding box of the Map2DArea @lt the left-top vertex @...
bool checkLocationInsideArea(yarp::dev::Nav2D::Map2DLocation loc)
Check if a Map2DLocation is inside a Map2DArea.
bool getCentroid(yarp::dev::Nav2D::Map2DLocation ¢)
retrieves the centroid of the area @cent the centroid
yarp::math::Vec2D< double > & operator[](size_t index)
Returns a vertex of the area.
bool isValid() const
Checks if the Map2DArea is valid return true if the Map2DArea is valid.
A mini-server for performing network communication in the background.
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.