Horizon
|
Public Member Functions | |
SEG () | |
Default constructor Creates an empty (0, 0) segment. | |
SEG (int aX1, int aY1, int aX2, int aY2) | |
Constructor Creates a segment between (aX1, aY1) and (aX2, aY2) | |
SEG (const VECTOR2I &aA, const VECTOR2I &aB) | |
Constructor Creates a segment between (aA) and (aB) | |
SEG (const VECTOR2I &aA, const VECTOR2I &aB, int aIndex) | |
Constructor Creates a segment between (aA) and (aB), referenced to a multi-segment shape. More... | |
SEG (const SEG &aSeg) | |
Copy constructor. | |
SEG & | operator= (const SEG &aSeg) |
bool | operator== (const SEG &aSeg) const |
bool | operator!= (const SEG &aSeg) const |
VECTOR2I | LineProject (const VECTOR2I &aP) const |
Function LineProject() More... | |
int | Side (const VECTOR2I &aP) const |
Function Side() More... | |
int | LineDistance (const VECTOR2I &aP, bool aDetermineSide=false) const |
Function LineDistance() More... | |
const VECTOR2I | NearestPoint (const VECTOR2I &aP) const |
Function NearestPoint() More... | |
OPT_VECTOR2I | Intersect (const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const |
Function Intersect() More... | |
OPT_VECTOR2I | IntersectLines (const SEG &aSeg) const |
Function IntersectLines() More... | |
bool | Collide (const SEG &aSeg, int aClearance) const |
ecoord | SquaredDistance (const SEG &aSeg) const |
int | Distance (const SEG &aSeg) const |
Function Distance() More... | |
ecoord | SquaredDistance (const VECTOR2I &aP) const |
int | Distance (const VECTOR2I &aP) const |
Function Distance() More... | |
void | CanonicalCoefs (ecoord &qA, ecoord &qB, ecoord &qC) const |
bool | Collinear (const SEG &aSeg) const |
Function Collinear() More... | |
bool | ApproxCollinear (const SEG &aSeg) const |
bool | ApproxParallel (const SEG &aSeg) const |
bool | Overlaps (const SEG &aSeg) const |
int | Length () const |
Function Length() More... | |
ecoord | SquaredLength () const |
ecoord | TCoef (const VECTOR2I &aP) const |
int | Index () const |
Function Index() More... | |
bool | Contains (const VECTOR2I &aP) const |
bool | PointCloserThan (const VECTOR2I &aP, int aDist) const |
void | Reverse () |
VECTOR2I | Center () const |
| |
Public Attributes | |
VECTOR2I | A |
VECTOR2I | B |
Friends | |
std::ostream & | operator<< (std::ostream &aStream, const SEG &aSeg) |
Constructor Creates a segment between (aA) and (aB), referenced to a multi-segment shape.
aA | reference to the start point in the parent shape |
aB | reference to the end point in the parent shape |
aIndex | index of the segment within the parent shape |
|
inline |
Function Collinear()
Checks if segment aSeg lies on the same line as (this).
aSeg | the segment to chech colinearity with |
|
inline |
Function Distance()
Computes minimum Euclidean distance to segment aSeg.
aSeg | other segment |
|
inline |
Function Distance()
Computes minimum Euclidean distance to point aP.
aP | the point |
|
inline |
Function Index()
Return the index of this segment in its parent shape (applicable only to non-local segments)
OPT_VECTOR2I SEG::Intersect | ( | const SEG & | aSeg, |
bool | aIgnoreEndpoints = false , |
||
bool | aLines = false |
||
) | const |
Function Intersect()
Computes intersection point of segment (this) with segment aSeg.
aSeg | segment to intersect with |
aIgnoreEndpoints | don't treat corner cases (i.e. end of one segment touching the other) as intersections. |
aLines | treat segments as infinite lines |
|
inline |
Function IntersectLines()
Computes the intersection point of lines passing through ends of (this) and aSeg
aSeg | segment defining the line to intersect with |
|
inline |
|
inline |
Function LineDistance()
Returns the closest Euclidean distance between point aP and the line defined by the ends of segment (this).
aP | the point to test |
aDetermineSide | when true, the sign of the returned value indicates the side of the line at which we are (negative = left) |
Function LineProject()
Computes the perpendicular projection point of aP on a line passing through ends of the segment.
aP | point to project |
Function NearestPoint()
Computes a point on the segment (this) that is closest to point aP.
|
inline |
Function Side()
Determines on which side of directed line passing via segment ends point aP lies.
aP | point to determine the orientation wrs to self |