link to new example added in manual
cosmetic changes in examples
This commit is contained in:
@@ -8,20 +8,21 @@ typedef CGAL::Circular_arc_2<Circular_k> Circular_arc_2;
|
||||
|
||||
int main()
|
||||
{
|
||||
int n = 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 j = 0; j <= 10; j++) {
|
||||
Point_2 p = Point_2(i, j);
|
||||
if(Circular_k().has_on_2_object()(c,p)) {
|
||||
n++;
|
||||
std::cout << "(" << i << "," << j << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "There are " << n << " points in the [0,..,10]x[0,..,10] " <<
|
||||
"grid on the circular" << std::endl
|
||||
<< " arc defined counterclockwisely by the points (0,0), (5,5), (10,0)"
|
||||
<< std::endl << "See the points above." << std::endl;
|
||||
int n = 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 j = 0; j <= 10; j++) {
|
||||
Point_2 p = Point_2(i, j);
|
||||
if(Circular_k().has_on_2_object()(c,p)) {
|
||||
n++;
|
||||
std::cout << "(" << i << "," << j << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << "There are " << n << " points in the [0,..,10]x[0,..,10] "
|
||||
<< "grid on the circular" << std::endl
|
||||
<< " arc defined counterclockwisely by the points (0,0), (5,5), (10,0)"
|
||||
<< std::endl << "See the points above." << std::endl;
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -12,9 +12,11 @@ double prob_2() {
|
||||
CGAL::Random_points_in_square_2<Point_2> g(1.0);
|
||||
double prob = 0.0;
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
|
||||
Point_2 p1, p2, p3, p4, p5, p6;
|
||||
p1 = *g++; p2 = *g++; p3 = *g++;
|
||||
p4 = *g++; p5 = *g++; p6 = *g++;
|
||||
|
||||
// the pi's are points inherited from the Cartesian kernel Point_2, so,
|
||||
// the orientation predicate can be called on them
|
||||
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 << "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::endl << std::endl;
|
||||
|
||||
std::cout << "And what about the probability that two circles formed by"
|
||||
<< 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;
|
||||
return 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user