mirror of https://github.com/CGAL/cgal
link to new example added in manual
cosmetic changes in examples
This commit is contained in:
parent
c6597a6402
commit
18ebbef2b7
|
|
@ -63,13 +63,18 @@ that is based on similar techniques as
|
||||||
%benchmarking should still be done and further optimizations will be
|
%benchmarking should still be done and further optimizations will be
|
||||||
%provided for future releases.}
|
%provided for future releases.}
|
||||||
|
|
||||||
\section{Example}
|
\section{Examples}
|
||||||
|
|
||||||
This example shows how to construct circles or circular arcs from
|
The first example shows how to construct circles or circular arcs from
|
||||||
points, and how to compute intersections between them.
|
points, and how to compute intersections between them using the global
|
||||||
|
function.
|
||||||
|
|
||||||
\ccIncludeExampleCode{Circular_kernel_2/intersecting_arcs.cpp}
|
\ccIncludeExampleCode{Circular_kernel_2/intersecting_arcs.cpp}
|
||||||
|
|
||||||
|
The following example shows how to use a functor of the kernel.
|
||||||
|
|
||||||
|
\ccIncludeExampleCode{Circular_kernel_2/functor_has_on.cpp}
|
||||||
|
|
||||||
\section{Design and Implementation History}
|
\section{Design and Implementation History}
|
||||||
|
|
||||||
The first pieces of prototype code were comparisons of algebraic
|
The first pieces of prototype code were comparisons of algebraic
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ int main()
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
Circular_arc_2 c = Circular_arc_2(Point_2(10,0), Point_2(5,5), Point_2(0, 0));
|
Circular_arc_2 c = Circular_arc_2(Point_2(10,0), Point_2(5,5), Point_2(0, 0));
|
||||||
|
|
||||||
for(int i = 0; i <= 10; i++) {
|
for(int i = 0; i <= 10; i++) {
|
||||||
for(int j = 0; j <= 10; j++) {
|
for(int j = 0; j <= 10; j++) {
|
||||||
Point_2 p = Point_2(i, j);
|
Point_2 p = Point_2(i, j);
|
||||||
|
|
@ -19,8 +20,8 @@ int main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << "There are " << n << " points in the [0,..,10]x[0,..,10] " <<
|
std::cout << "There are " << n << " points in the [0,..,10]x[0,..,10] "
|
||||||
"grid on the circular" << std::endl
|
<< "grid on the circular" << std::endl
|
||||||
<< " arc defined counterclockwisely by the points (0,0), (5,5), (10,0)"
|
<< " arc defined counterclockwisely by the points (0,0), (5,5), (10,0)"
|
||||||
<< std::endl << "See the points above." << std::endl;
|
<< std::endl << "See the points above." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,11 @@ double prob_2() {
|
||||||
CGAL::Random_points_in_square_2<Point_2> g(1.0);
|
CGAL::Random_points_in_square_2<Point_2> g(1.0);
|
||||||
double prob = 0.0;
|
double prob = 0.0;
|
||||||
for (int i = 0; i < 10000; i++) {
|
for (int i = 0; i < 10000; i++) {
|
||||||
|
|
||||||
Point_2 p1, p2, p3, p4, p5, p6;
|
Point_2 p1, p2, p3, p4, p5, p6;
|
||||||
p1 = *g++; p2 = *g++; p3 = *g++;
|
p1 = *g++; p2 = *g++; p3 = *g++;
|
||||||
p4 = *g++; p5 = *g++; p6 = *g++;
|
p4 = *g++; p5 = *g++; p6 = *g++;
|
||||||
|
|
||||||
// the pi's are points inherited from the Cartesian kernel Point_2, so,
|
// the pi's are points inherited from the Cartesian kernel Point_2, so,
|
||||||
// the orientation predicate can be called on them
|
// the orientation predicate can be called on them
|
||||||
if(CGAL::orientation(p1, p2, p3) != CGAL::COUNTERCLOCKWISE) std::swap(p1, p3);
|
if(CGAL::orientation(p1, p2, p3) != CGAL::COUNTERCLOCKWISE) std::swap(p1, p3);
|
||||||
|
|
@ -34,13 +36,14 @@ int main()
|
||||||
{
|
{
|
||||||
std::cout << "What is the probability that two arcs formed by" << std::endl;
|
std::cout << "What is the probability that two arcs formed by" << std::endl;
|
||||||
std::cout << "three random counterclockwise-oriented points on" << std::endl;
|
std::cout << "three random counterclockwise-oriented points on" << std::endl;
|
||||||
std::cout << "an unity square intersect? (wait a second please)" << std::endl;
|
std::cout << "an unit square intersect? (wait a second please)" << std::endl;
|
||||||
std::cout << "The probability is: " << prob_2<Circular_arc_2>() <<
|
std::cout << "The probability is: " << prob_2<Circular_arc_2>() <<
|
||||||
std::endl << std::endl;
|
std::endl << std::endl;
|
||||||
|
|
||||||
std::cout << "And what about the probability that two circles formed by"
|
std::cout << "And what about the probability that two circles formed by"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
std::cout << "three random counterclockwise-oriented points on" << std::endl;
|
std::cout << "three random counterclockwise-oriented points on" << std::endl;
|
||||||
std::cout << "an unity square intersect? (wait a second please)" << std::endl;
|
std::cout << "an unit square intersect? (wait a second please)" << std::endl;
|
||||||
std::cout << "The probability is: " << prob_2<Circle_2>() << std::endl;
|
std::cout << "The probability is: " << prob_2<Circle_2>() << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue