#include <CGAL/predicates_on_points_3.h>
|
|
| |||
| returns POSITIVE, if lies on the positive side of the oriented plane defined by , , and , returns NEGATIVE if lies on the negative side of , and returns COPLANAR if lies on . | ||||
|
|
| |||
| returns true, if , , , and are coplanar. | ||||
|
|
| |||
| returns true, if , , and are collinear. | ||||
Analogously to the two-dimensional case, there are some additional tests for 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:
|
|
| |||
| 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. | ||||
|
|
| |||
| 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 (as it is an expensive operation).
|
|
| |||
|
returns true, iff q lies between p
and r. Precondition: p, q and r are collinear. | ||||
|
|
| |||
|
returns true, iff q lies strictly between p
and r. Precondition: p, q and r are collinear. | ||||
Similarly, there is a test for the special cases of coplanarity. If we want to know the order of coplanar points with respect to the plane they define, this is the functions to call:
|
|
| |||
|
Let be the plane defined by the points p, q,
and r. Note that the order defines the orientation of
. The function computes the orientation of points p,
q, and s in : Iff p, q, s are
collinear, COLLINEAR is returned. Iff and the plane
defined by p, q, and s have the same orientation,
POSITIVE is returned; otherwise NEGATIVE is returned. Precondition: p, q, r, and s are coplanar and p, q, and r are not collinear. | ||||
The following predicates the relative position of a point with respect to a sphere implicitly defined by four points.
#include <CGAL/predicates_on_points_3.h>
|
|
| |||
|
returns the relative position of point test
to the sphere defined by , , , and . The order
of the points , , , and does not matter. Precondition: p, q, r and s are not coplanar. | ||||
|
|
| |||
|
returns the relative position of point test
to the oriented sphere defined by , , and .
The order of the points , , , and is important,
since it determines the orientation of the implicitly
constructed sphere. If the points , , and
are positive oriented, positive side is the bounded interior
of the sphere. Precondition: p, q, r and s are not coplanar. | ||||
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_3.h>
|
|
| |
| returns true, iff p and q have the same x-coordinate. | ||
|
|
| |
| returns true, iff p and q have the same y-coordinate. | ||
|
|
| |
| returns true, iff p and q have the same z-coordinate. | ||
The above functions, returning a bool, are decision versions of the following comparison functions, returning a Comparison_result.
|
|
| |
|
|
| |
|
|
| |
For lexicographical comparison CGAL provides
|
|
| |||
| Compares the Cartesian coordinates of points p and q lexicographically in order: first -coordinates are compared, if they are equal, -coordinates are compared, and if both - and - coordinate are equal, -coordinates are compared. | ||||
In addition, CGAL provides the following comparison functions returning true or false depending on the result of compare_lexicographically_xyz(p,q).
|
|
| |||
|
|
| |||
Distance comparisons, Section
.