Fawkes API  Fawkes Development Version
fawkes::NavGraphPolygonConstraint Class Reference

Constraint that blocks nodes within and edges touching a polygon. More...

#include <>>

Inheritance diagram for fawkes::NavGraphPolygonConstraint:

Classes

struct  Point_
 Simple point representation for polygon. More...
 

Public Types

typedef struct fawkes::NavGraphPolygonConstraint::Point_ Point
 Simple point representation for polygon. More...
 
typedef unsigned int PolygonHandle
 Handle for polygon for selective removal. More...
 
typedef std::vector< PointPolygon
 A vector of points makes a polygon. More...
 
typedef std::map< PolygonHandle, PolygonPolygonMap
 Map for accessing all polygons at once with their handles. More...
 

Public Member Functions

virtual ~NavGraphPolygonConstraint ()
 Virtual empty destructor. More...
 
const PolygonMappolygons () const
 Get reference to the map of polygons. More...
 
PolygonHandle add_polygon (const Polygon &polygon)
 Add a polygon to constraint list. More...
 
void remove_polygon (const PolygonHandle &handle)
 Remove a polygon from the constraint list. More...
 
void clear_polygons ()
 Remove all polygons. More...
 

Protected Member Functions

 NavGraphPolygonConstraint ()
 Constructor. More...
 
 NavGraphPolygonConstraint (const Polygon &polygon)
 Constructor. More...
 
bool in_poly (const Point &point, const Polygon &polygon)
 Check if given point lies inside the polygon. More...
 
bool on_poly (const Point &p1, const Point &p2, const Polygon &polygon)
 Check if a line segments lies on a given polygon. More...
 

Protected Attributes

PolygonMap polygons_
 currently registered polygons More...
 

Detailed Description

Constraint that blocks nodes within and edges touching a polygon.

Author
Tim Niemueller

Definition at line 37 of file polygon_constraint.h.

Member Typedef Documentation

◆ Point

Simple point representation for polygon.

◆ Polygon

A vector of points makes a polygon.

Definition at line 53 of file polygon_constraint.h.

◆ PolygonHandle

Handle for polygon for selective removal.

Definition at line 51 of file polygon_constraint.h.

◆ PolygonMap

Map for accessing all polygons at once with their handles.

Definition at line 55 of file polygon_constraint.h.

Constructor & Destructor Documentation

◆ ~NavGraphPolygonConstraint()

fawkes::NavGraphPolygonConstraint::~NavGraphPolygonConstraint ( )
virtual

Virtual empty destructor.

Definition at line 55 of file polygon_constraint.cpp.

◆ NavGraphPolygonConstraint() [1/2]

fawkes::NavGraphPolygonConstraint::NavGraphPolygonConstraint ( )
protected

Constructor.

Definition at line 38 of file polygon_constraint.cpp.

◆ NavGraphPolygonConstraint() [2/2]

fawkes::NavGraphPolygonConstraint::NavGraphPolygonConstraint ( const Polygon polygon)
protected

Constructor.

Parameters
polygonpolygon to add immediately

Definition at line 48 of file polygon_constraint.cpp.

References add_polygon().

Member Function Documentation

◆ add_polygon()

NavGraphPolygonConstraint::PolygonHandle fawkes::NavGraphPolygonConstraint::add_polygon ( const Polygon polygon)

Add a polygon to constraint list.

Parameters
polygonPolygon to add to the list
Returns
handle for the added polygon. The handle can be used to remove the polygon later.

Definition at line 66 of file polygon_constraint.cpp.

References polygons_.

Referenced by NavGraphStaticConstraintsThread::init(), and NavGraphPolygonConstraint().

◆ clear_polygons()

void fawkes::NavGraphPolygonConstraint::clear_polygons ( )

Remove all polygons.

Definition at line 97 of file polygon_constraint.cpp.

References polygons_.

◆ in_poly()

bool fawkes::NavGraphPolygonConstraint::in_poly ( const Point point,
const Polygon polygon 
)
protected

Check if given point lies inside the polygon.

The point and polygon are assumed to be in the same X-Y plane. Code based on http://www.visibone.com/inpoly/inpoly.c.txt Copyright (c) 1995-1996 Galacticomm, Inc. Freeware source code. Bob Stein and Craig Yap Adapted from PCL pcl::isXYPointIn2DXYPolygon()

Parameters
pointpoint to check if it lies within the given polygon
polygonpolygon to check against
Returns
true if the point lies inside the polygon, false otherwise

Definition at line 115 of file polygon_constraint.cpp.

References fawkes::NavGraphPolygonConstraint::Point_::x, and fawkes::NavGraphPolygonConstraint::Point_::y.

Referenced by fawkes::NavGraphPolygonNodeConstraint::blocks().

◆ on_poly()

bool fawkes::NavGraphPolygonConstraint::on_poly ( const Point p1,
const Point p2,
const Polygon polygon 
)
protected

Check if a line segments lies on a given polygon.

Parameters
p1first point of line segment
p2second point of line segment
polygonpolygon to check against
Returns
true if the line segment lies on the polygon, false otherwise

Definition at line 179 of file polygon_constraint.cpp.

References fawkes::NavGraphPolygonConstraint::Point_::x, and fawkes::NavGraphPolygonConstraint::Point_::y.

Referenced by fawkes::NavGraphPolygonEdgeConstraint::blocks().

◆ polygons()

const NavGraphPolygonConstraint::PolygonMap & fawkes::NavGraphPolygonConstraint::polygons ( ) const

Get reference to the map of polygons.

Returns
map reference of polygons

Definition at line 89 of file polygon_constraint.cpp.

References polygons_.

◆ remove_polygon()

void fawkes::NavGraphPolygonConstraint::remove_polygon ( const PolygonHandle handle)

Remove a polygon from the constraint list.

Parameters
handlehandle of polygon to remove

Definition at line 77 of file polygon_constraint.cpp.

References polygons_.

Member Data Documentation

◆ polygons_


The documentation for this class was generated from the following files: