|
ICAROUS
|
#include <DensityGrid.h>
Public Member Functions | |
| DensityGrid () | |
| DensityGrid (const BoundingRectangle &b, const NavPoint &start, const Position &end, int buffer, double sqSz, bool ll) | |
| DensityGrid (const Plan &p, int buffer, double squareSize) | |
| DensityGrid (const Plan &p, double startT, int buffer, double squareSize) | |
| double | getNativeSquareDist () const |
| double | getSquareDist () const |
| void | snapToStart () |
| std::pair< int, int > | gridPosition (Position p) const |
| bool | containsCell (const std::pair< int, int > &xy) const |
| int | sizeX () const |
| int | sizeY () const |
| Position | getPosition (int x, int y) const |
| Position | getPosition (const std::pair< int, int > &pii) const |
| Position | center (int x, int y) const |
| Position | center (const std::pair< int, int > &pii) const |
| double | getWeight (int x, int y) const |
| double | getWeight (const std::pair< int, int > &pii) const |
| void | setWeight (int x, int y, double d) |
| void | clearWeight (int x, int y) |
| void | setWeights (int minX, int minY, int maxX, int maxY, double d) |
| void | setWeights (double d) |
| void | clearWeightsOutside (SimplePoly poly) |
| void | setWeightsInside (SimplePoly poly, double d) |
| void | clearWeights () |
| Position | startPoint () const |
| Position | endPoint () const |
| double | startTime () const |
| std::vector< std::pair< int, int > > | gridPath (const Plan &p) const |
| void | printGridPath (const std::vector< std::pair< int, int > > &gPath) |
| Plan | gridPathToPlan (const std::vector< std::pair< int, int > > &gPath, double gs, double vs) |
| void | setProximityWeights (const std::vector< std::pair< int, int > > &gPath, double factor, bool applyToUndefined) |
| void | setProximityWeights (const Plan &p, double factor, bool applyToUndefined) |
| void | setPolyWeights (double time, const std::vector< PolyPath > &path) |
| std::string | toString () const |
| void | printWeights () const |
| void | printCorners () const |
Static Public Member Functions | |
| static double | distEstLatLon (double lat1, double lat2) |
| static std::vector< std::pair< int, int > > | thin (const std::vector< std::pair< int, int > > &gPath) |
Protected Member Functions | |
| void | init (const BoundingRectangle &b, const NavPoint &start, const Position &end, int buffer, double sqSz, bool ll) |
Protected Attributes | |
| Position | startPoint_ |
| double | startTime_ |
| Position | endPoint_ |
| std::map< std::pair< int, int >, double > | weights |
| std::map< std::pair< int, int >, double >::iterator | weightspos |
| std::map< std::pair< int, int >, std::pair< double, double > > | corners |
| std::map< std::pair< int, int >, std::pair< double, double > >::iterator | cornerspos |
| std::vector< std::pair< int, int > >::iterator | gPathpos |
| bool | latLon |
| double | squareSize |
| double | squareDist |
| int | sz_x |
| int | sz_y |
| BoundingRectangle | bounds |
| double | minSearchedWeightValue |
| double | maxSearchedWeightValue |
Private Member Functions | |
| bool | contains (const std::vector< std::pair< int, int > > &gPath, const std::pair< int, int > &pii) const |
Static Private Member Functions | |
| static double | linearEstY (double lati, double dn) |
| static bool | validPair (const std::pair< int, int > &p) |
A DensityGrid is a weighted grid that is used to support a heuristic search through a rectangular region. Each cell in the grid is roughly similar in size (in lat/lon the actual size and shape may vary somewhat with latitude). The grid enables a heuristic search that attempts to find the optimal path through the grid based on the assigned weights to cells from a start position to an end position. As an example, a search used with weather data may assign weights based the cell's distance from the end cell, as well as if the cell is free of any weather polygons.
| larcfm::DensityGrid::DensityGrid | ( | ) |
Create a completely empty DensityGrid that has no specified location or area
| larcfm::DensityGrid::DensityGrid | ( | const BoundingRectangle & | b, |
| const NavPoint & | start, | ||
| const Position & | end, | ||
| int | buffer, | ||
| double | sqSz, | ||
| bool | ll | ||
| ) |
Create a blank DensityGrid that covers a certain area. Note: grid coordinates refer to the bottom left (SW) corner of a grid square.
| b | rectangle that roughly outlines base search area |
| start | start position and time, should be within b |
| end | end position, should be within b |
| buffer | number of additional squares to include for each side outside of the base grid area |
| sqSz | approximate square size, in meters |
| ll | if true, coordinates are latlon, if false, euclidean |
| larcfm::DensityGrid::DensityGrid | ( | const Plan & | p, |
| int | buffer, | ||
| double | squareSize | ||
| ) |
Create a blank DensityGrid based on a complete plan Note: grid coordinates refer to the bottom left (SW) corner of a grid square.
| p | plan that defines the base grid area |
| buffer | number of additional squares to include for each side outside of the base grid area |
| squareSize | approximate square size, in meters |
| larcfm::DensityGrid::DensityGrid | ( | const Plan & | p, |
| double | startT, | ||
| int | buffer, | ||
| double | squareSize | ||
| ) |
Create a blank DensityGrid based on an in-progress plan (plan points before the current time are ignored) Note: grid coordinates refer to the bottom left (SW) corner of a grid square.
| p | plan that defines the base grid area |
| startT | current-time in the plan |
| buffer | number of additional squares to include for each side outside of the base grid area |
| squareSize | approximate square size, in meters |
| void larcfm::DensityGrid::clearWeightsOutside | ( | SimplePoly | poly | ) |
Clear all weights of grid squares whose center is outside the given (static) polygon.
| poly |
| double larcfm::DensityGrid::getNativeSquareDist | ( | ) | const |
Approximate size of square, in either meters (if Euclidean) or radians (if latlon)
Approximate size of square, in either meters (if Euclidean) or radians (if latlon)
| double larcfm::DensityGrid::getSquareDist | ( | ) | const |
Approximate size of square, in meters
Approximate size of square, in meters
| void larcfm::DensityGrid::setProximityWeights | ( | const Plan & | p, |
| double | factor, | ||
| bool | applyToUndefined | ||
| ) |
Weight against plan points. Weight should be 0 for on-plan, and factor*yxdistance for off-plan. (Weight is against the closest plan point)
| p | plan |
| factor | factor |
| applyToUndefined | true, if should be applied to undefined points |
Weight against plan points.
| p | |
| factor |
| void larcfm::DensityGrid::setWeights | ( | double | d | ) |
Set all weights to d
| d | weight |
Set all weights to d
| void larcfm::DensityGrid::setWeights | ( | int | minX, |
| int | minY, | ||
| int | maxX, | ||
| int | maxY, | ||
| double | d | ||
| ) |
Set all weights to d in grid cells minX to maxX and minY to maxY, inclusive
| minX | minimum x |
| minY | minimum y |
| maxX | maximum x |
| maxY | maximum y |
| d | weight |
Set all weights to d in grid cells minX to maxX and minY to maxY, inclusive
| void larcfm::DensityGrid::setWeightsInside | ( | SimplePoly | poly, |
| double | d | ||
| ) |
set all weights of grid squares whose center is inside the given (static) polygon.
| poly | polygon |
| d | weight |
set all weights of grid squares whose center is inside the given (static) polygon.
| poly |
| int larcfm::DensityGrid::sizeX | ( | ) | const |
Note: the grid size should be 1 larger than expected (to allow for the first point to be in the middle of the square) The SW corner of the plan bounding box should be in square (buffer,buffer)
| int larcfm::DensityGrid::sizeY | ( | ) | const |
Note: the grid size should be 1 larger than expected (to allow for the first point to be in the middle of the square)
Note: the grid size should be 1 larger than expected (to allow for the first point to be in the middle of the square)
| void larcfm::DensityGrid::snapToStart | ( | ) |
Adjust all grid corner coordinates so that the start point it in the center of its grid.