Go to the source code of this file.
|
enum class | codac2::OrientationInterval { } |
| Enumeration representing feasible orientations. Can be used to assess an oriented angle, or the alignement of three points. More...
|
|
- Date
- 2024
- Author
- Simon Rohou
- Copyright
- Copyright 2024 Codac Team
- License: GNU Lesser General Public License (LGPL)
◆ OrientationInterval
Enumeration representing feasible orientations. Can be used to assess an oriented angle, or the alignement of three points.
The logical operator |
can be used to combine OrientationInterval
values.
Enumerator |
---|
UNKNOWN | UNKNOWN : the orientation can be either clockwise, counter-clockwise, or aligned.
|
25 {
26 COLINEAR = 0x01,
27 CLOCKWISE = 0x02,
28 COUNTERCLOCKWISE = 0x04,
32 };
@ UNKNOWN
Definition codac2_BoolInterval.h:29
@ EMPTY
Definition codac2_BoolInterval.h:27
◆ operator<<()
Streams out a OrientationInterval.
- Parameters
-
os | The stream to be updated |
x | The orientation interval to stream out |
- Returns
- A Reference to the updated stream
45 {
46 if(x == OrientationInterval::EMPTY)
47 os << "[ empty ]";
48 else if(x == OrientationInterval::COLINEAR)
49 os << "[ col ]";
50 else if(x == OrientationInterval::CLOCKWISE)
51 os << "[ cw ]";
52 else if(x == OrientationInterval::COUNTERCLOCKWISE)
53 os << "[ ccw ]";
54 else if(x == (OrientationInterval::COLINEAR | OrientationInterval::CLOCKWISE))
55 os << "[ col, cw ]";
56 else if(x == (OrientationInterval::COLINEAR | OrientationInterval::COUNTERCLOCKWISE))
57 os << "[ col, ccw ]";
59 os << "[ col, cw, ccw ]";
60 return os;
61 }
@ UNKNOWN
Definition codac2_geometry.h:31
◆ orientation()
OrientationInterval codac2::orientation |
( |
const IntervalVector & | p1, |
|
|
const IntervalVector & | p2, |
|
|
const IntervalVector & | p3 ) |
Computes the orientation of an ordered triplet of 2D points.
Determines whether the oriented angle \(\widehat{p_1 p_2 p_3}\) is positive (counterclockwise), negative (clockwise), or if the points are colinear (flat or 0 angle). Depending on floating point uncertainties, the test may not be able to conclude (a UNKNOWN
value would then be returned).
- Parameters
-
p1 | First point (2d IntervalVector ) of the triplet. |
p2 | Second point (2d IntervalVector ) of the triplet (vertex of the angle). |
p3 | Third point (2d IntervalVector ) of the triplet. |
- Returns
- An orientation of type
OrientationInterval
◆ aligned()
BoolInterval codac2::aligned |
( |
const IntervalVector & | p1, |
|
|
const IntervalVector & | p2, |
|
|
const IntervalVector & | p3 ) |
Checks whether three 2D points are aligned (colinear).
Determines if the points lie on the same straight line using an orientation test (cross product). Depending on floating point uncertainties, the test may not be able to conclude (a UNKNOWN
value would then be returned).
- Parameters
-
p1 | First point (2d IntervalVector ) of the triplet. |
p2 | Second point (2d IntervalVector ) of the triplet. |
p3 | Third point (2d IntervalVector ) of the triplet. |
- Returns
- A
BooleanInterval
◆ convex_hull()
std::vector< IntervalVector > codac2::convex_hull |
( |
std::vector< IntervalVector > | pts | ) |
|
Computes the convex hull of a set of 2d points.
Given a set of 2d points enclosed in tiny boxes, the function computes their convex hull. The method is based on a Graham scan algorithm. The output list of the algorithm is a subset of the input list, with same uncertainties and a possible different order.
- Parameters
-
pts | 2d points in any order |
- Returns
- Points on the convex hull in counterclockwise order.