![]() |
|
|
| |
| Two objects obj1 and obj2 intersect if there is a point p that is part of both obj1 and obj2. The intersection region of those two objects is defined as the set of all points p that are part of both obj1 and obj2. Note that for objects like triangles and polygons that enclose a bounded region, this region is considered part of the object. If a segment lies completely inside a triangle, then those two objects intersect and the intersection region is the complete segment. | ||
The possible value for types Type1 and Type2 and the possible return values wrapped in Object are the following:
There is also an intersection function between 3 planes.
|
|
| |||
| returns the intersection of 3 planes, which can be either a point, a line, a plane, or empty. | ||||
The following example demonstrates the most common use of intersection routines.
#include <CGAL/intersections.h>
void foo(CGAL::Segment_2<Kernel> seg, CGAL::Line_2<Kernel> line)
{
CGAL::Object result;
CGAL::Point_2<Kernel> ipoint;
CGAL::Segment_2<Kernel> iseg;
result = CGAL::intersection(seg, line);
if (CGAL::assign(ipoint, result)) {
// handle the point intersection case.
} else
if (CGAL::assign(iseg, result)) {
// handle the segment intersection case.
} else {
// handle the no intersection case.
}
}