From 5aeb11a03a3d6db1b7ec6ee42c18de815396486b Mon Sep 17 00:00:00 2001 From: Monique Teillaud Date: Tue, 16 Sep 2008 09:11:18 +0000 Subject: [PATCH] added link to the functor example in the manual + cosmetic changes in the examples --- .../doc_tex/Circular_kernel_3/CK.tex | 11 ++-- .../Circular_kernel_3/functor_has_on.cpp | 53 ++++++++----------- ..._kernel_3.cpp => intersecting_spheres.cpp} | 0 3 files changed, 30 insertions(+), 34 deletions(-) rename Circular_kernel_3/examples/Circular_kernel_3/{spherical_kernel_3.cpp => intersecting_spheres.cpp} (100%) diff --git a/Circular_kernel_3/doc_tex/Circular_kernel_3/CK.tex b/Circular_kernel_3/doc_tex/Circular_kernel_3/CK.tex index 2a74af1f0af..f12c1aa2b7d 100644 --- a/Circular_kernel_3/doc_tex/Circular_kernel_3/CK.tex +++ b/Circular_kernel_3/doc_tex/Circular_kernel_3/CK.tex @@ -69,11 +69,16 @@ In fact, the spherical kernel is documented as a concept, \item {} and a predefined kernel \ccc{Exact_spherical_kernel_3}. \end{itemize} -\section{Example} +\section{Examples} -This example shows how to construct spheres and compute intersections on them. +The first example shows how to construct spheres and compute +intersections on them using the global function. -\ccIncludeExampleCode{Circular_kernel_3/spherical_kernel_3.cpp} +\ccIncludeExampleCode{Circular_kernel_3/intersecting_spheres.cpp} + +The second example illustrates the use of a functor. + +\ccIncludeExampleCode{Circular_kernel_3/functor_has_on.cpp} \section{Design and Implementation History} diff --git a/Circular_kernel_3/examples/Circular_kernel_3/functor_has_on.cpp b/Circular_kernel_3/examples/Circular_kernel_3/functor_has_on.cpp index a9d50b3298b..bf8117575b3 100644 --- a/Circular_kernel_3/examples/Circular_kernel_3/functor_has_on.cpp +++ b/Circular_kernel_3/examples/Circular_kernel_3/functor_has_on.cpp @@ -1,40 +1,31 @@ -#include -#include - -#include -#include - -#include - +#include #include -typedef CGAL::Quotient NT; -typedef CGAL::Cartesian Linear_k; -typedef CGAL::Algebraic_kernel_for_spheres_2_3 Algebraic_k; -typedef CGAL::Spherical_kernel_3 Spherical_k; +typedef CGAL::Exact_spherical_kernel_3 Spherical_k; -typedef CGAL::Point_3 Point_3; -typedef CGAL::Circular_arc_3 Circular_arc_3; +typedef CGAL::Point_3 Point_3; +typedef CGAL::Circular_arc_3 Circular_arc_3; int main() { - int n = 0; - Circular_arc_3 c = Circular_arc_3(Point_3(10,10,0), Point_3(5,5,5), Point_3(0, 0, 0)); - for(int i = 0; i <= 10; i++) { - for(int j = 0; j <= 10; j++) { - for(int k = 0; k <= 10; k++) { - Point_3 p = Point_3(i, j, k); - if(Spherical_k().has_on_3_object()(c,p)) { - n++; - std::cout << "(" << i << "," << j << "," << k << ")" << std::endl; - } - } - } + int n = 0; + Circular_arc_3 c = Circular_arc_3(Point_3(10,10,0), Point_3(5,5,5), Point_3(0, 0, 0)); + for(int i = 0; i <= 10; i++) { + for(int j = 0; j <= 10; j++) { + for(int k = 0; k <= 10; k++) { + Point_3 p = Point_3(i, j, k); + if(Spherical_k().has_on_3_object()(c,p)) { + n++; + std::cout << "(" << i << "," << j << "," << k << ")" << std::endl; } - std::cout << "There are " << n << " points in the " << - "[0,..,10]x[0,..,10]x[0,...,10] " << - "grid on the circular" << std::endl << - " arc defined by the points (10,10,0), (5,5,5), (0,0,0)" << - std::endl << "See the points above." << std::endl; + } + } + } + + std::cout << "There are " << n << " points in the " + << "[0,..,10]x[0,..,10]x[0,...,10] " + << "grid on the circular" << std::endl + << " arc defined by the points (10,10,0), (5,5,5), (0,0,0)" + << std::endl << "See the points above." << std::endl; return 0; }; diff --git a/Circular_kernel_3/examples/Circular_kernel_3/spherical_kernel_3.cpp b/Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp similarity index 100% rename from Circular_kernel_3/examples/Circular_kernel_3/spherical_kernel_3.cpp rename to Circular_kernel_3/examples/Circular_kernel_3/intersecting_spheres.cpp