\begin{ccRefFunction}{intersection} \ccInclude{CGAL/intersections_d.h} \ccFunction{Kernel::Intersect_d::Result, Type2 >::Type intersection(Type1 f1, Type2 f2);} { returns the intersection result of $f1$ and $f2$. \ccPrecond The objects are of the same dimension.} The same functionality is also available through the functor \ccc{Kernel::Intersect_d}. The possible value for types \ccStyle{Type1} and \ccStyle{Type2} and the value for T\ldots in \ccStyle{boost::optional< boost::variant< T\ldots >} are the following: \begin{ccTexOnly} \begin{longtable}[c]{|l|l|l|} %\caption{All available intersection computations}\\ \multicolumn{3}{l}{\sl \ \ } \endfirsthead \multicolumn{3}{l}{\sl continued} \endhead \hline Type1 & Type2 & \parbox{4 cm}{\vspace{1 mm}{T\ldots}} \\ \hline \ccStyle{Line_d} & \ccStyle{Line_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Line_d} \vspace{1 mm}} \\ \hline \ccStyle{Segment_d} & \ccStyle{Line_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Segment_d} \vspace{1 mm}} \\ \hline \ccStyle{Segment_d} & \ccStyle{Segment_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Segment_d} \vspace{1 mm}} \\ \hline \ccStyle{Ray_d} & \ccStyle{Line_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Ray_d} \vspace{1 mm}} \\ \hline \ccStyle{Ray_d} & \ccStyle{Segment_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Segment_d} \vspace{1 mm}} \\ \hline \ccStyle{Ray_d} & \ccStyle{Ray_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Segment_d}, \ccStyle{Ray_d} \vspace{1 mm}} \\ \hline \ccStyle{Hyperplane_d} & \ccStyle{Line_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_3}, \ccStyle{Line_3} \vspace{1 mm}} \\ \hline \ccStyle{Hyperplane_d} & \ccStyle{Ray_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Ray_d} \vspace{1 mm}} \\ \hline \ccStyle{Hyperplane_d} & \ccStyle{Segment_d} & \parbox{4 cm}{\vspace{1 mm} \ccStyle{Point_d}, \ccStyle{Segment_d} \vspace{1 mm}} \\ \hline \end{longtable} \end{ccTexOnly} \begin{ccHtmlOnly}
Type1 Type2 T...
Line_d Line_d
Point_d
Line_d
Segment_d Line_d
Point_d
Segment_d
Segment_d Segment_d
Point_d
Segment_d
Ray_d Line_d
Point_d
Ray_d
Ray_d Segment_d
Point_d
Segment_d
Ray_d Ray_d
Point_d
Segment_d
Ray_d
Hyperplane_d Line_d
Point_d
Line_d
Hyperplane_d Ray_d
Point_d
Ray_d
Hyperplane_d Segment_d
Point_d
Segment_d
\end{ccHtmlOnly} \ccExample The following example demonstrates the most common use of \ccc{intersection} routines. \ccHtmlLinksOff% \begin{verbatim} #include template struct Intersection_visitor { typedef result_type void; void operator()(const Point_d& p) const { /* handle point */ } void operator()(const Segment_d& s) const { /* handle segment */ } }; template void foo(Segment_d seg, Line_d lin) { R::Intersect_d::template Result< Segment_d, Line_d > result = intersection(seg, lin); if(result) { boost::apply_visitor(Intersection_visitor(), *result); } else { /* no intersection */ } } \end{verbatim}% \ccHtmlLinksOn% \ccSeeAlso \ccc{do_intersect}, \\ \ccc{Kernel::Intersect_d}, \\ \ccc{Kernel::Do_intersect_d}, \\ \ccAnchor{http://www.boost.org/doc/libs/release/libs/optional/index.html}{boost::optional}, \\ \ccAnchor{http://www.boost.org/doc/html/variant.html}{boost::variant} \\ \end{ccRefFunction}