mirror of https://github.com/CGAL/cgal
Use object_cast instead of assign in the example
This commit is contained in:
parent
7757dda09e
commit
aec07c1fe2
|
|
@ -338,25 +338,21 @@ The following example demonstrates the most common use of
|
||||||
|
|
||||||
void foo(CGAL::Segment_2<Kernel> seg, CGAL::Line_2<Kernel> line)
|
void foo(CGAL::Segment_2<Kernel> seg, CGAL::Line_2<Kernel> line)
|
||||||
{
|
{
|
||||||
CGAL::Object result;
|
CGAL::Object result = CGAL::intersection(seg, line);
|
||||||
CGAL::Point_2<Kernel> ipoint;
|
if (const CGAL::Point_2<Kernel> *ipoint = CGAL::object_cast<CGAL::Point_2<Kernel> >(&result)) {
|
||||||
CGAL::Segment_2<Kernel> iseg;
|
|
||||||
|
|
||||||
result = CGAL::intersection(seg, line);
|
|
||||||
if (CGAL::assign(ipoint, result)) {
|
|
||||||
\end{verbatim}%
|
\end{verbatim}%
|
||||||
\ccHtmlLinksOff%
|
\ccHtmlLinksOff%
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
// handle the point intersection case.
|
// handle the point intersection case with *ipoint.
|
||||||
\end{verbatim}%
|
\end{verbatim}%
|
||||||
\ccHtmlLinksOn%
|
\ccHtmlLinksOn%
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
} else
|
} else
|
||||||
if (CGAL::assign(iseg, result)) {
|
if (const CGAL::Segment_2<Kernel> *iseg = CGAL::object_cast<CGAL::Segment_2<Kernel> >(&result)) {
|
||||||
\end{verbatim}%
|
\end{verbatim}%
|
||||||
\ccHtmlLinksOff%
|
\ccHtmlLinksOff%
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
// handle the segment intersection case.
|
// handle the segment intersection case with *iseg.
|
||||||
\end{verbatim}%
|
\end{verbatim}%
|
||||||
\ccHtmlLinksOn%
|
\ccHtmlLinksOn%
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue