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

Classes

class  SIComparator
 

Static Public Member Functions

static SimplePoly convexHull (const std::vector< Position > &plist, double bottom, double top)
 
static SimplePoly convexHull (const SimplePoly &p)
 
static SimplePoly convexHull (const std::vector< SimplePoly > &p)
 
static SimplePoly convexHull (const SimplePoly &p, double buffer)
 
static Position pushOut (SimplePoly &poly, const Position &p, double buffer)
 
static Position pushOut (SimplePoly &poly, int i, double buffer)
 
static SimplePoly simplify2 (SimplePoly &p, double buffer)
 
static SimplePoly simplify (SimplePoly &p, double buffer)
 
static SimplePoly simplify (SimplePoly &p)
 
static SimplePoly simplifyToSize (SimplePoly &p, int num)
 
static SimplePoly stretchOverTime (const SimplePoly &sp, const Velocity &v, double timeBefore, double timeAfter)
 
static PolyPath stretchOverTime (const PolyPath &pbase, double timeBefore, double timeAfter)
 
static SimplePoly bufferedConvexHull (SimplePoly &p, double hbuff, double vbuff)
 
static PolyPath bufferedConvexHull (const PolyPath &pbase, double hbuff, double vbuff)
 
static double intersectsPolygon2D (const Plan &p, PolyPath &pp, double B, double T, double incr)
 
static Plan reducePlanAgainstPolys (const Plan &plan, double gs, std::vector< PolyPath > &paths, double incr, bool leadInsPresent, const std::vector< PolyPath > &containment)
 
static Plan reducePlanAgainstPolys (const Plan &pln, double gs, std::vector< PolyPath > &paths, double incr, bool leadInsPresent)
 
static std::pair< double, std::string > isPlanInConflictWx (const Plan &plan, std::vector< PolyPath > &paths, double start, double end, double incr)
 
static std::pair< double, std::string > isPlanInConflictWx (const Plan &plan, std::vector< PolyPath > &paths, double incr)
 
static std::pair< double, std::string > isPlanInConflictWx (const Plan &plan, std::vector< PolyPath > &paths, double incr, double fromTime)
 
static bool isPlanContained (const Plan &plan, const std::vector< PolyPath > &paths, double B, double T, double incr)
 
static double calculateWxExitTime (const Plan &plan, std::vector< PolyPath > &paths, double incr, double entryTime)
 

Member Function Documentation

◆ bufferedConvexHull() [1/2]

PolyPath larcfm::PolyUtil::bufferedConvexHull ( const PolyPath pbase,
double  hbuff,
double  vbuff 
)
static

Return a path where polygons are replaced by convex hulls that have been expanded by hbuff and vbuff.

Parameters
pbasebase polygon path
hbuffsize of horizontal buffer (approx)
vbuffsize of vertical buffer
Returns
path of convex hulls

◆ bufferedConvexHull() [2/2]

SimplePoly larcfm::PolyUtil::bufferedConvexHull ( SimplePoly p,
double  hbuff,
double  vbuff 
)
static

Return a convex hull that has been expanded by hbuff and vbuff. This extends the polygons around points, both perpendicular to the segments and directly away from vertices, approximating a round join. There may be points outside the resulting hull (near vertices) that are slightly closer to the original than the requested buffer.

Parameters
pbase polygon
hbuffsize of horizontal buffer (approx)
vbuffsize of vertical buffer
Returns
convex hull

◆ calculateWxExitTime()

double larcfm::PolyUtil::calculateWxExitTime ( const Plan plan,
std::vector< PolyPath > &  paths,
double  incr,
double  entryTime 
)
static

Given that plan is in loss with paths at time entryTime, then this function returns the exit time

Parameters
planplan
pathspolygon paths
incrincrement
entryTimetime
Returns
exit time

◆ convexHull() [1/3]

SimplePoly larcfm::PolyUtil::convexHull ( const SimplePoly p,
double  buffer 
)
static

Returns the convex hull of a polygon that has been expanded by (approximately) the given buffer size. This is done by adding additional points around each polygon point and taking the convex hull of them all. This assumes that the resulting hull will not include the north or south poles.

Parameters
ppolygon
bufferbuffer
Returns
polygon

◆ convexHull() [2/3]

SimplePoly larcfm::PolyUtil::convexHull ( const std::vector< Position > &  plist,
double  bottom,
double  top 
)
static

Return a polygon that is the convex hull of the listed points. This uses the Graham scan algorithm. For purposes of this algorithm, we only consider x, y values of positions (since all calculations are relative and no points are moved). This uses the NE-most point as the origin, to allow for our track computations (0 is north) and proceeds in a clockwise fashion This assumes that the resulting hull will not include the north or south poles (for lat lon positions)

Parameters
plistlist of positions
bottomlower altitude
toptop altitude
Returns
SimplePoly

◆ convexHull() [3/3]

SimplePoly larcfm::PolyUtil::convexHull ( const std::vector< SimplePoly > &  p)
static

Returns the convex hull of a set of polygons. This assumes that the resulting hull will not include the north or south poles.

Parameters
plist of polygons
Returns
convex hull (top and bottom from max min values

◆ intersectsPolygon2D()

double larcfm::PolyUtil::intersectsPolygon2D ( const Plan p,
PolyPath pp,
double  B,
double  T,
double  incr 
)
static

This is a SLOW, APPROXIMATE test for 2D intersection between a moving polygon and a moving point. For more accurate (and verified) tests for this property, see polygon functions in the ACCoRD framework, specifically classes that implement the DetectionPolygon interface and CDIIPolygon.

Parameters
pplan describing point-mass trajectory
pppath describing polygon movement
Bstart time to check (absolute)
Tend time to check (absolute)
incrtime increment for search (> 0)
Returns
time of loss of separation if aircraft will intersect with the polygon between times B and T and polygon name that plan is in conflict with

Note: the return time will be at an interior point, and the name of the polygon

◆ isPlanContained()

bool larcfm::PolyUtil::isPlanContained ( const Plan plan,
const std::vector< PolyPath > &  paths,
double  B,
double  T,
double  incr 
)
static

Returns time of intersection if the plan is NOT free of polygons from time start to time end. This may miss intrusions of up to incr sec so it may not detect

Parameters
planplan to test
pathsset of polygons
Bstart time of search
Tend time of search
incrsearch increment
Returns
time of intersection with a polygon if it occurs when search time interval, otherwise -1 and polygon name that plan is in conflict with

Returns time of intersection if the plan is NOT free of polygons from time start to time end. This may miss intrusions of up to incr sec so it may not detect

Parameters
planplan to test
pathsset of polygons
startstart time of search
endend time of search
incrsearch increment
Returns
time of intersection with a polygon if it occurs when search time interval, otherwise -1 and polygon name that plan is in conflict with

◆ pushOut() [1/2]

Position larcfm::PolyUtil::pushOut ( SimplePoly poly,
const Position p,
double  buffer 
)
static

Return a position that is buffer distance further away from the poly's centroid

Parameters
polypolygon
pposition
bufferbuffer
Returns
position

◆ pushOut() [2/2]

Position larcfm::PolyUtil::pushOut ( SimplePoly poly,
int  i,
double  buffer 
)
static

Return a position that is buffer distance further away from the poly's centroid at vertex i

Parameters
polypolygon
iindex
bufferbuffer
Returns
position

◆ reducePlanAgainstPolys()

Plan larcfm::PolyUtil::reducePlanAgainstPolys ( const Plan plan,
double  gs,
std::vector< PolyPath > &  paths,
double  incr,
bool  leadInsPresent,
const std::vector< PolyPath > &  containment 
)
static

Attempt to minimize a given plan (by removing points) such that new segments do not intersect with any polygons. This uses the intersectsPolygon2D() check, and so has the limitations associated with it. Use ACCoRD calls instead for better performance and/or more accuracy. Returns a new plan that is hopefully smaller than the original plan.

Parameters
pplan
pathspaths
incrincrement
Returns
plan

fpln(" !!! reducePlanAgainstPolys: WARNING: input plan is not conflict free!!!");

◆ simplify()

SimplePoly larcfm::PolyUtil::simplify ( SimplePoly p,
double  buffer 
)
static

Attempt to (over) approximate the given polygon with one with fewer edges.

Parameters
poriginal polygon
bufferapproximate increase in size in any dimension.
Returns
new larger polygon, or original polygon on failure

◆ simplifyToSize()

SimplePoly larcfm::PolyUtil::simplifyToSize ( SimplePoly p,
int  num 
)
static

Attempt to over-approximate a polygons with one with the specified number of vertices. This will automatically increase the buffer by up to 30% of the original's max radius value, and either stop there or when we have no more than the desired number of vertices.

Parameters
poriginal polygon
numdesired number of vertices
Returns
simple polygon

◆ stretchOverTime() [1/2]

PolyPath larcfm::PolyUtil::stretchOverTime ( const PolyPath pbase,
double  timeBefore,
double  timeAfter 
)
static

Given a polypath, expand the polygons on it so they at least cover the areas that they would when over a longer time. Note: this does not work for MORPHING paths, and will convert them instead to USER_VEL_FINITE paths. Polygons are expanded to a new convex hull, meaning this will be an over-approximation. This may also not be accurate for paths with very long legs in geodetic coordinates. This may also overestimate the polygons at the start and end of each leg in the path.

Parameters
pbasestarting path
timeBeforetime before the base path time to cover (relative, in seconds)
timeAftertime after the base path time to cover (relative, in seconds)
Returns
new path with expanded polygons.

◆ stretchOverTime() [2/2]

SimplePoly larcfm::PolyUtil::stretchOverTime ( const SimplePoly sp,
const Velocity v,
double  timeBefore,
double  timeAfter 
)
static

Stretch a polygon so that it covers (at least) what the original would as it moves over a given time range. The uses a convex hull, so will be an over-approximation. There may be inaccuracies for very long periods of time if using geodesic coordinates.

Example: Given a polygon W and an aircraft A with a timeAfter of 100 seconds, a conflict detection for A against the stretched polygon W' is approximately equivalent to the disjunction of conflict detections (any positive is a positive) of the set A' against the original W, where A' is the set A plus all of "echos" timeshifted up to 100 seconds into the past, modulo distortion from geodetic projections and convex hull expansions. Effectively this is saying that if the conflict detection of A vs. W' is clear, then A will be clear of W and any aircraft that precisely follow A will also be clear of W for up to 100 seconds. (If it were not clear for 100 seconds, then A would have impacted the extended W', which "arrives" 100 seconds earlier than W would.)

Similarly for timeBefore.

If A is clear of W', then it is also clear of the original W, which is a subset of W'.

Note this technique does not necessarily work for morphing polygons.

Parameters
spbase polygon
vaverage velocity of polygon
timeBeforetime before stated position to cover (in sec)
timeAftertime after stated position to cover (in sec)
Returns
enlarged polygon

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