ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | List of all members
larcfm::DensityGrid Class Reference

#include <DensityGrid.h>

Inheritance diagram for larcfm::DensityGrid:
larcfm::DensityGridTimed larcfm::DensityGridMovingPolys larcfm::DensityGridMovingPolysEst

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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DensityGrid() [1/4]

larcfm::DensityGrid::DensityGrid ( )

Create a completely empty DensityGrid that has no specified location or area

◆ DensityGrid() [2/4]

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.

Parameters
brectangle that roughly outlines base search area
startstart position and time, should be within b
endend position, should be within b
buffernumber of additional squares to include for each side outside of the base grid area
sqSzapproximate square size, in meters
llif true, coordinates are latlon, if false, euclidean

◆ DensityGrid() [3/4]

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.

Parameters
pplan that defines the base grid area
buffernumber of additional squares to include for each side outside of the base grid area
squareSizeapproximate square size, in meters

◆ DensityGrid() [4/4]

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.

Parameters
pplan that defines the base grid area
startTcurrent-time in the plan
buffernumber of additional squares to include for each side outside of the base grid area
squareSizeapproximate square size, in meters

Member Function Documentation

◆ clearWeightsOutside()

void larcfm::DensityGrid::clearWeightsOutside ( SimplePoly  poly)

Clear all weights of grid squares whose center is outside the given (static) polygon.

Parameters
poly

◆ getNativeSquareDist()

double larcfm::DensityGrid::getNativeSquareDist ( ) const

Approximate size of square, in either meters (if Euclidean) or radians (if latlon)

Returns
size

Approximate size of square, in either meters (if Euclidean) or radians (if latlon)

Returns

◆ getSquareDist()

double larcfm::DensityGrid::getSquareDist ( ) const

Approximate size of square, in meters

Returns
size

Approximate size of square, in meters

◆ setProximityWeights()

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)

Parameters
pplan
factorfactor
applyToUndefinedtrue, if should be applied to undefined points

Weight against plan points.

Parameters
p
factor

◆ setWeights() [1/2]

void larcfm::DensityGrid::setWeights ( double  d)

Set all weights to d

Parameters
dweight

Set all weights to d

◆ setWeights() [2/2]

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

Parameters
minXminimum x
minYminimum y
maxXmaximum x
maxYmaximum y
dweight

Set all weights to d in grid cells minX to maxX and minY to maxY, inclusive

◆ setWeightsInside()

void larcfm::DensityGrid::setWeightsInside ( SimplePoly  poly,
double  d 
)

set all weights of grid squares whose center is inside the given (static) polygon.

Parameters
polypolygon
dweight

set all weights of grid squares whose center is inside the given (static) polygon.

Parameters
poly

◆ sizeX()

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)

Returns
size

◆ sizeY()

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)

Returns
size

Note: the grid size should be 1 larger than expected (to allow for the first point to be in the middle of the square)

Returns

◆ snapToStart()

void larcfm::DensityGrid::snapToStart ( )

Adjust all grid corner coordinates so that the start point it in the center of its grid.


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