Small example: using a functor + A forgotten Copy Constructor

This commit is contained in:
Pedro Machado Manhaes de Castro 2008-09-12 14:43:12 +00:00
parent 32c222e7dd
commit 3ac5443b35
4 changed files with 32 additions and 3 deletions

1
.gitattributes vendored
View File

@ -1275,6 +1275,7 @@ Circular_kernel_2/demo/Circular_kernel_2/help/sweeper.jpeg -text svneol=unset#im
Circular_kernel_2/demo/Circular_kernel_2/help/trash.jpeg -text svneol=unset#image/jpeg
Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation.png -text
Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation_detail.png -text
Circular_kernel_2/examples/Circular_kernel_2/functor_has_on.cpp -text
Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h -text
Circular_kernel_3/demo/Circular_kernel_3/images/button_axis.gif -text svneol=unset#image/gif
Circular_kernel_3/demo/Circular_kernel_3/images/button_light.gif -text svneol=unset#image/gif

View File

@ -0,0 +1,24 @@
#include <CGAL/Exact_circular_kernel_2.h>
#include <CGAL/point_generators_2.h>
typedef CGAL::Exact_circular_kernel_2 Circular_k;
typedef CGAL::Point_2<Circular_k> Point_2;
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 = 1; i <= 5; i++) {
for(int j = 1; j <= 10; j++) {
Point_2 p = Point_2(i, j);
if(Circular_k().has_on_2_object()(c,p)) n++;
}
}
std::cout << "There are " << n << " points in the 10x5 grid on the circular"
<< std::endl
<< " arc with endpoints (0,0), (10,0) defined on the superior half plane"
<< std::endl;
return 0;
};

View File

@ -6,7 +6,6 @@ typedef CGAL::Exact_circular_kernel_2 Circular_k;
typedef CGAL::Point_2<Circular_k> Point_2;
typedef CGAL::Circle_2<Circular_k> Circle_2;
typedef CGAL::Circular_arc_2<Circular_k> Circular_arc_2;
typedef CGAL::Line_arc_2<Circular_k> Line_arc_2;
template <typename T>
double prob_2() {

View File

@ -140,9 +140,10 @@ struct Filtered_bbox_circular_kernel_2;
template < typename CK >
class Circular_arc_point_2 < Filtered_bbox_circular_kernel_2 < CK > > {
typedef Filtered_bbox_circular_kernel_2 < CK > BK;
typedef typename CK::FT FT;
typedef typename CK::RT RT;
typedef typename CK::Point_2 Point_2;
typedef typename BK::Point_2 Point_2;
typedef typename CK::Line_2 Line_2;
typedef typename CK::Circle_2 Circle_2;
typedef typename CK::Circular_arc_point_2 Rcircular_arc_point_2;
@ -160,7 +161,11 @@ public:
{}
Circular_arc_point_2(const Root_for_circles_2_2 & np)
: P_point(np),bb(NULL)
: P_point(np), bb(NULL)
{}
Circular_arc_point_2(const Point_2 & p)
: P_point(p), bb(NULL)
{}
Circular_arc_point_2(const Rcircular_arc_point_2 & p)