AURobotServers  4
Public Member Functions | Public Attributes | Private Member Functions | List of all members
UAvoidLink Class Reference

#include <uavoidlink.h>

Public Member Functions

void clear ()
 
UPosition getOtherEnd (int k)
 
int getOtherEndIdx (int k)
 
ULineSegment getTangentLine (int idx)
 
UPosition getThisEnd (int k)
 
void setBadEdgeAndVertex (double margin)
 
 UAvoidLink ()
 
void visibilityTest (UAvoidLink *other)
 

Public Attributes

UAvoidObstaob
 
int aobIdx [4]
 
UAvoidLinkempty
 
int idx [4]
 
UAvoidLinkSeq * lnkSeq [4]
 
UAvoidLinkmirror
 
UAvoidLinknext
 
int serial
 
int tangentCnt
 
UAvoidObsttob
 
bool valid [4]
 

Private Member Functions

bool isWithin (double x, double lim1, double lim2)
 

Detailed Description

An AvoidLine is describes tangent lines between two obstacles. in total 4 tangent lines can exist between any two obstacles. An array with 4 entries describe the valid tangent lines, and the connection details. The lines atr always orderd as follows: index : this other
0 : CV(L) CV(L) – cross tangent
1 : CCV(R) CV(L) – outher tangent
2 : CV(L) CCV(R) – outher tangent
3 : CCV(R) CCV(R). – cross tangent.
this +–-----—2-----—/–+ other
+++ \ / +++
+++++ –3------—0 ++++
++++ / \ ++++++
+----—/-—1—\ ---—++
I.e.: index 1 is CCV when tangent is fixed on 'this' obstacle and hits 'other' when turned CCV. Or when fixed on 'other' obstacle hits 'this' obstacle when turned CV. I.e.2: index 0 and 1 follows 'this' obstacle in a CCV direction, and index 0 and 2 follows the 'other' obstacle in a CV direction.

Each tangent line is associated with an obstacle. The same line is thus defined for both obstacles. One of the lines has a link to the other (mirror) line.

Constructor & Destructor Documentation

UAvoidLink::UAvoidLink ( )
inline

Constructor

References clear(), and empty.

Member Function Documentation

void UAvoidLink::clear ( void  )
inline
UPosition UAvoidLink::getOtherEnd ( int  k)

Get position at the other end of the tangent line with this index number (k). If the tangent line is not valid, then en empty line segment is returned.

Referenced by clear(), and UAvoidPath2::findRoutes().

int UAvoidLink::getOtherEndIdx ( int  k)

A tangent index number for this obstacle can also be seen from the other obstacle, but with a different index number. This function returns that index number. The index number is the same for index 0 and 3 and 1 and 2 are reversed. Returns the converted index number.

Referenced by clear().

ULineSegment UAvoidLink::getTangentLine ( int  idx)
UPosition UAvoidLink::getThisEnd ( int  k)

Get position at the this end of the tangent line with this index number (k). If the tangent line is not valid, then en empty line segment is returned.

Referenced by clear(), and UAvoidPath2::createPointList().

bool UAvoidLink::isWithin ( double  x,
double  lim1,
double  lim2 
)
private
Returns
true if x is between these two limits within a margin of 1e-4.
Parameters
xis the test value.
lim1is the first limit (may be smaller or larget than lim2.
lim1is the second limit (may be smaller or larget than lim1.
Returns
true if at least an epsilon of 0.0001 within these limits.

References a.

Referenced by clear().

void UAvoidLink::setBadEdgeAndVertex ( double  margin)

when outher tangens are valid, the inner part of vetices (and edges) are tested for proximity to other obstacle (within 'margin'), if within margin those vertices and adjecent edge atr marked as nogo (for path tangents).

References UPosition::x, and UPosition::y.

Referenced by clear(), and UAvoidPath2::createTangentLinks().

void UAvoidLink::visibilityTest ( UAvoidLink other)

Test visibility of the lines in this link against the obstacle in the other link. This is done by testing the cross point between each line against a line across the other obstacle (between the tangent points).

References a, aob, aobIdx, U2Dline::getCrossing(), UPolygon::getMostDistantVertexXY(), UPolygon::getPoint(), UPolygon::getPointsCnt(), UAvoidObst::obst, U2Dline::set2P(), valid, UPosition::x, and UPosition::y.

Referenced by clear(), and UAvoidObst::testVisibility().

Member Data Documentation

UAvoidObst* UAvoidLink::aob
int UAvoidLink::aobIdx[4]

Index to position in other obstacle polygon. The 4 elements are tangents in the direction from this and the other: index : this other
0 : CV(L) CV(L) – cross tangent
1 : CCV(R) CV(L) – outher tangent
2 : CV(L) CCV(R) – outher tangent
3 : CCV(R) CCV(R). – cross tangent.

Referenced by UAvoidPath2::addLnksToOpenSet(), UAvoidObst::addtangentLines(), clear(), UAvoidPath2::createPointList(), UAvoidPath2::findRouteInALoop(), UAvoidPath2::findRouteToDest(), UAvoidLnkSeq::getDistance(), UAvoidPath2::isInClosedSet(), UAvoidPath2::logPathSequences(), UAvoidPath2::removeTangentIfNoExitTangent(), UFunctionAvoid::sendCurrentAvoidPath(), UAvoidPath2::terminateWorseCandidatesInOpenSet(), UAvoidPath2::testNoVisSegVisibility(), and visibilityTest().

UAvoidLink* UAvoidLink::empty

Link to next in free chain

Referenced by UAvoidPath2::getEmptyALnk(), UAvoidLink(), and UAvoidPath2::~UAvoidPath2().

int UAvoidLink::idx[4]
UAvoidLinkSeq* UAvoidLink::lnkSeq[4]

Link to link sequence that that this link is part of

Referenced by clear().

UAvoidLink* UAvoidLink::mirror
UAvoidLink* UAvoidLink::next
int UAvoidLink::serial
int UAvoidLink::tangentCnt

Number of tangent lines connecting this object with the other. It sould be 4 for normal objects, but will be 2 for point obstacles and for start and end points.

Referenced by UAvoidObst::addtangentLines(), clear(), UAvoidPath2::countValidVisibilityLines(), UAvoidPath2::createTangentLinks(), UAvoidPath2::findRoutes(), UAvoidPath2::findRoutesA(), UAvoidPath2::removeTangentIfNoExitTangent(), UAvoidPath2::removeTangentInConcavities(), and UAvoidPath2::testNoVisSegVisibility().

UAvoidObst* UAvoidLink::tob
bool UAvoidLink::valid[4]

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