|
Horizon
|
Public Types | |
| using | ecoord = VECTOR2I::extended_type |
Public Member Functions | |
| SEG () | |
| Create an empty (0, 0) segment. | |
| SEG (int aX1, int aY1, int aX2, int aY2) | |
| Create a segment between (aX1, aY1) and (aX2, aY2). | |
| SEG (const VECTOR2I &aA, const VECTOR2I &aB) | |
| Create a segment between (aA) and (aB). | |
| SEG (const VECTOR2I &aA, const VECTOR2I &aB, int aIndex) | |
| Create a segment between (aA) and (aB), referenced to a multi-segment shape. | |
| 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 |
| Compute the perpendicular projection point of aP on a line passing through ends of the segment. | |
| int | Side (const VECTOR2I &aP) const |
| Determine on which side of directed line passing via segment ends point aP lies. | |
| int | LineDistance (const VECTOR2I &aP, bool aDetermineSide=false) const |
| Return the closest Euclidean distance between point aP and the line defined by the ends of segment (this). | |
| double | AngleDegrees (const SEG &aOther) const |
| Determine the smallest angle between two segments (result in degrees). | |
| const VECTOR2I | NearestPoint (const VECTOR2I &aP) const |
| Compute a point on the segment (this) that is closest to point aP. | |
| const VECTOR2I | NearestPoint (const SEG &aSeg) const |
| Compute a point on the segment (this) that is closest to any point on aSeg. | |
| const VECTOR2I | ReflectPoint (const VECTOR2I &aP) const |
| Reflect a point using this segment as axis. | |
| OPT_VECTOR2I | Intersect (const SEG &aSeg, bool aIgnoreEndpoints=false, bool aLines=false) const |
| Compute intersection point of segment (this) with segment aSeg. | |
| bool | Intersects (const SEG &aSeg) const |
| OPT_VECTOR2I | IntersectLines (const SEG &aSeg) const |
| Compute the intersection point of lines passing through ends of (this) and aSeg. | |
| SEG | PerpendicularSeg (const VECTOR2I &aP) const |
| Compute a segment perpendicular to this one, passing through point aP. | |
| SEG | ParallelSeg (const VECTOR2I &aP) const |
| Compute a segment parallel to this one, passing through point aP. | |
| bool | Collide (const SEG &aSeg, int aClearance, int *aActual=nullptr) const |
| ecoord | SquaredDistance (const SEG &aSeg) const |
| int | Distance (const SEG &aSeg) const |
| Compute minimum Euclidean distance to segment aSeg. | |
| ecoord | SquaredDistance (const VECTOR2I &aP) const |
| int | Distance (const VECTOR2I &aP) const |
| Compute minimum Euclidean distance to point aP. | |
| void | CanonicalCoefs (ecoord &qA, ecoord &qB, ecoord &qC) const |
| bool | Collinear (const SEG &aSeg) const |
| Check if segment aSeg lies on the same line as (this). | |
| bool | ApproxCollinear (const SEG &aSeg) const |
| bool | ApproxParallel (const SEG &aSeg, int aDistanceThreshold=1) const |
| bool | ApproxPerpendicular (const SEG &aSeg) const |
| bool | Overlaps (const SEG &aSeg) const |
| bool | Contains (const SEG &aSeg) const |
| int | Length () const |
| Return the length (this). | |
| ecoord | SquaredLength () const |
| ecoord | TCoef (const VECTOR2I &aP) const |
| int | Index () const |
| Return the index of this segment in its parent shape (applicable only to non-local segments). | |
| bool | Contains (const VECTOR2I &aP) const |
| void | Reverse () |
| SEG | Reversed () const |
| Returns the center point of the line. | |
| VECTOR2I | Center () const |
Static Public Member Functions | |
| static SEG::ecoord | Square (int a) |
Public Attributes | |
| VECTOR2I | A |
| VECTOR2I | B |
Friends | |
| std::ostream & | operator<< (std::ostream &aStream, const SEG &aSeg) |
|
inline |
Create 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 |
| double SEG::AngleDegrees | ( | const SEG & | aOther | ) | const |
Determine the smallest angle between two segments (result in degrees).
| aOther | point to determine the orientation wrs to self |
|
inline |
Check if segment aSeg lies on the same line as (this).
| aSeg | the segment to check colinearity with |
| int SEG::Distance | ( | const SEG & | aSeg | ) | const |
Compute minimum Euclidean distance to segment aSeg.
| aSeg | other segment |
| int SEG::Distance | ( | const VECTOR2I & | aP | ) | const |
Compute minimum Euclidean distance to point aP.
| aP | the point |
|
inline |
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 |
Compute 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 |
Compute the intersection point of lines passing through ends of (this) and aSeg.
| aSeg | segment defining the line to intersect with |
|
inline |
Return the length (this).
| int SEG::LineDistance | ( | const VECTOR2I & | aP, |
| bool | aDetermineSide = false ) const |
Return 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) |
| VECTOR2I SEG::LineProject | ( | const VECTOR2I & | aP | ) | const |
Compute the perpendicular projection point of aP on a line passing through ends of the segment.
| aP | point to project |
| const VECTOR2I SEG::NearestPoint | ( | const SEG & | aSeg | ) | const |
Compute a point on the segment (this) that is closest to any point on aSeg.
| const VECTOR2I SEG::NearestPoint | ( | const VECTOR2I & | aP | ) | const |
Compute a point on the segment (this) that is closest to point aP.
| SEG SEG::ParallelSeg | ( | const VECTOR2I & | aP | ) | const |
Compute a segment parallel to this one, passing through point aP.
| aP | Point through which the new segment will pass |
| SEG SEG::PerpendicularSeg | ( | const VECTOR2I & | aP | ) | const |
Compute a segment perpendicular to this one, passing through point aP.
| aP | Point through which the new segment will pass |
| const VECTOR2I SEG::ReflectPoint | ( | const VECTOR2I & | aP | ) | const |
Reflect a point using this segment as axis.
|
inline |
Determine on which side of directed line passing via segment ends point aP lies.
| aP | point to determine the orientation wrs to self |