Navigation:
Up,
Table of Contents,
Bibliography,
Index,
Title Page
2D Geometric Predicates
Order Type Predicates
The following functions return true or false
depending on whether the orientation of three points is equal to
one of the constants mentioned in
.
Finally, there are some special cases of collinearity. If we not only
want to know if three points are collinear but also if they respect a
certain order on the line, these are the functions to call:
bool
|
|
| |
returns true, iff the three points are collinear and
q lies between p and r. Note that true
is returned, if q==p or q==r.
|
|
bool
|
|
| |
returns true, iff the three points are collinear and
q lies strictly between p and r. Note that
false is returned, if q==p or q==r.
|
If we already know that three points are collinear, we should not
check it again.
bool
|
|
| |
returns true, iff q lies between p and
r. Precondition: p, q and
r are collinear.
|
|
bool
|
|
| |
returns true, iff q lies strictly between p
and r. Precondition: p, q and
r are collinear.
|
The Incircle Test
Instead of constructing a circle and performing the test if a
given point lies inside or outside you might use the following
predicate:
CGAL_Bounded_side
|
|
| |
returns the relative position of point test to the circle
defined by , and . The
order of the points , and
does not matter. Precondition:
p, q and r are not collinear.
|
|
CGAL_Oriented_side
|
|
| |
returns the relative position of point test to the oriented
circle defined by , and
. The order of the points ,
and is important, since it determines
the orientation of the implicitly constructed circle.
Precondition: p, q and r are not
collinear.
|
Comparison of Coordinates of Points
In order to check if two points have the same or coordinate
we provide the following functions. They allow to write code that
does not depend on the representation type.
#include <CGAL/predicates_on_points_2.h>
The above functions, returning a bool, are decision versions of the
following comparison functions, returning a CGAL_Comparison_result.
CGAL offers the same functions for points given implicitly as intersection
of two lines. We provide these functions because we can provide
better code for the test, than simply computing the intersection and
calling the respective function for points.
Precondition: Lines that define an intersection point may not be parallel.
#include <CGAL/predicates_on_lines_2.h>
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of and the
intersection of lines and
, see (a) in the figure
below.
|
|
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of the intersection of line
with line and with line
, see (b) in the figure
below.
|
|
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of the intersection of
lines and and the intersection of
lines and
, see (c) in the figure
below.
|
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of and the
intersection of lines and
, see (a) in the figure
above.
|
|
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of the intersection of line
with line and with line
, see (b) in the figure
above.
|
|
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of the intersection of
lines and and the intersection of
lines and
, see (c) in the figure
above.
|
The following functions compare the y coordinate of an point
(that may be given implicitly) with a line.
Precondition: If the point is given as an intersection of two lines these
lines may not be parallel. Lines where points are projected on may not be
vertical.
CGAL_Comparison_result
|
|
|
| |
compares the -coordinates of and the
vertical projection of p on h
, see (d) in the figure
below.
|
|
CGAL_Comparison_result
|
|
|
| |
This function compares the -coordinates of the
vertical projection of p on h1 and on h2
, see (e) in the figure
below.
|
|
CGAL_Comparison_result
|
|
|
| |
Let be the intersection of lines and
. This function compares the
-coordinates of and the vertical
projection of p on h
, see (f) in the figure
below.
|
|
CGAL_Comparison_result
|
|
|
| |
Let be the intersection of lines and
. This function compares the
-coordinates of the vertical projection of p
on h1 and on h2 , see (g) in the figure
below.
|
For lexicographical comparison CGAL provides
CGAL_Comparison_result
|
|
|
| |
Compares the Cartesian coordinates of points p and q
lexicographically in order: first
-coordinates are compared, if they are equal,
-coordinates are compared.
|
In addition, CGAL provides the following comparison functions
returning true or false depending on the result
of CGAL_compare_lexicographically_xy(p,q).
See Also
Distance comparisons, Section
.
Next chapter: 2D Transformations
Navigation:
Up,
Table of Contents,
Bibliography,
Index,
Title Page
The CGAL Project. Wed, January 20, 1999.