From 70b3bee5afde96604b916eeb4375abbf2346d6b7 Mon Sep 17 00:00:00 2001 From: Sylvain Pion Date: Wed, 27 Dec 2006 23:26:06 +0000 Subject: [PATCH] Move 3D .bbox() to the functors to make Lazy_kernel pass, and enhance the test-suite to test .bbox() --- Kernel_23/include/CGAL/Iso_cuboid_3.h | 19 ++++++--- .../include/CGAL/Kernel/function_objects.h | 39 ----------------- Kernel_23/include/CGAL/Point_3.h | 6 +++ Kernel_23/include/CGAL/Segment_2.h | 15 +++---- Kernel_23/include/CGAL/Segment_3.h | 6 +++ Kernel_23/include/CGAL/Sphere_3.h | 7 ++++ Kernel_23/include/CGAL/Tetrahedron_3.h | 9 +++- Kernel_23/include/CGAL/Triangle_2.h | 42 +++++++------------ Kernel_23/include/CGAL/Triangle_3.h | 9 +++- .../include/CGAL/_test_cls_circle_2.h | 17 ++++++-- .../include/CGAL/_test_cls_iso_cuboid_3.h | 18 ++++++-- .../include/CGAL/_test_cls_iso_rectangle_2.h | 18 ++++++-- .../include/CGAL/_test_cls_point_2.h | 10 +++++ .../include/CGAL/_test_cls_point_3.h | 12 ++++++ .../include/CGAL/_test_cls_segment_2.h | 11 +++++ .../include/CGAL/_test_cls_segment_3.h | 10 +++++ .../include/CGAL/_test_cls_sphere_3.h | 14 ++++++- .../include/CGAL/_test_cls_tetrahedron_3.h | 17 +++++++- .../include/CGAL/_test_cls_triangle_2.h | 10 +++++ .../include/CGAL/_test_cls_triangle_3.h | 16 ++++++- Kernel_23/test/Kernel_23/makefile | 2 + 21 files changed, 209 insertions(+), 98 deletions(-) diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index 53f6844f7ee..b4d0ce48534 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -17,16 +17,17 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL_ISO_CUBOID_3_H #define CGAL_ISO_CUBOID_3_H #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -73,7 +74,7 @@ public: top, far_, close)) {} Iso_cuboid_3(const RT& min_hx, const RT& min_hy, const RT& min_hz, - const RT& max_hx, const RT& max_hy, const RT& max_hz, + const RT& max_hx, const RT& max_hy, const RT& max_hz, const RT& hw) : Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz, hw)) {} @@ -83,7 +84,7 @@ public: : Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), min_hx, min_hy, min_hz, max_hx, max_hy, max_hz)) {} -// TODO FIXME : why is Qrt not working here ? +// TODO FIXME : why is Qrt not working here ? // TODO : the Cartesian and Homogeneous functors should be split here // given that the Qrt differs. // (or is the Homogeneous optimization simply not worth it ?) @@ -159,7 +160,7 @@ public: return xmin(); else if (i == 1) return ymin(); - else + else return zmin(); } @@ -171,7 +172,7 @@ public: return xmax(); else if (i == 1) return ymax(); - else + else return zmax(); } @@ -217,6 +218,12 @@ public: return R().compute_volume_3_object()(*this); } + Bbox_3 + bbox() const + { + return R().construct_bbox_3_object()(*this); + } + }; diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 84fc4427229..718574cac18 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1703,45 +1703,6 @@ namespace CommonKernelFunctors { { return t.rep().vertex(i); } }; - - template - class Construct_bbox_3 - { - typedef typename K::Point_3 Point_3; - typedef typename K::Segment_3 Segment_3; - typedef typename K::Iso_cuboid_3 Iso_cuboid_3; - typedef typename K::Triangle_3 Triangle_3; - typedef typename K::Tetrahedron_3 Tetrahedron_3; - typedef typename K::Sphere_3 Sphere_3; - public: - typedef Bbox_3 result_type; - typedef Arity_tag< 1 > Arity; - - Bbox_3 - operator()( const Point_3& p) const - { return p.bbox(); } - - Bbox_3 - operator()( const Segment_3& s) const - { return s.bbox(); } - - Bbox_3 - operator()( const Triangle_3& t) const - { return t.bbox(); } - - Bbox_3 - operator()( const Iso_cuboid_3& r) const - { return r.bbox(); } - - Bbox_3 - operator()( const Tetrahedron_3& t) const - { return t.bbox(); } - - Bbox_3 - operator()( const Sphere_3& s) const - { return s.bbox(); } - }; - template class Construct_cartesian_const_iterator_2 { diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 68d0f99c1bf..dd036316872 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -29,6 +29,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -160,6 +161,11 @@ public: return 3; } + Bbox_3 bbox() const + { + return R().construct_bbox_3_object()(*this); + } + Point_3 transform(const Aff_transformation_3 &t) const { return t.transform(*this); diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index a2381fb44ef..9a66d78f8d4 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -118,7 +119,10 @@ public: bool is_degenerate() const; - Bbox_2 bbox() const; + Bbox_2 bbox() const + { + return R().construct_bbox_2_object()(*this); + } bool operator==(const Segment_2 &s) const @@ -126,7 +130,6 @@ public: return R().equal_2_object()(*this, s); } - bool operator!=(const Segment_2 &s) const { @@ -269,14 +272,6 @@ Segment_2::is_degenerate() const } -template < class R_ > -CGAL_KERNEL_INLINE -Bbox_2 -Segment_2::bbox() const -{ - return R().construct_bbox_2_object()(*this); -} - template < class R > std::ostream & diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index 176f6e88a66..6ef87d02091 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -158,6 +159,11 @@ public: return R().is_degenerate_3_object()(*this); } + Bbox_3 bbox() const + { + return R().construct_bbox_3_object()(*this); + } + Line_3 supporting_line() const { diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index e99368fa8aa..b2c41447eb5 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -161,6 +162,12 @@ public: //return CGAL_NTS is_zero(squared_radius()); } + Bbox_3 + bbox() const + { + return R().construct_bbox_3_object()(*this); + } + }; template diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index 71f78c59759..b0c1681b962 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -17,7 +17,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Andreas Fabri, Stefan Schirra @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -139,6 +140,12 @@ public: return R().compute_volume_3_object()(*this); } + Bbox_3 + bbox() const + { + return R().construct_bbox_3_object()(*this); + } + }; diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index 4097e6227da..93b175025ef 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -17,7 +17,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Andreas Fabri @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -70,7 +71,7 @@ public: { return R().compute_area_2_object()(vertex(0), vertex(1), vertex(2)); } - + Orientation orientation() const { @@ -83,96 +84,85 @@ public: return R().bounded_side_2_object()(*this,p); } - Oriented_side oriented_side(const Point_2 &p) const { return R().oriented_side_2_object()(*this,p); } - bool operator==(const Triangle_2 &t) const { return R().equal_2_object()(*this,t); } - - + bool operator!=(const Triangle_2 &t) const { return !(*this == t); } - + typename Qualified_result_of::type vertex(int i) const { return R().construct_vertex_2_object()(*this,i); } - + typename Qualified_result_of::type operator[](int i) const { return vertex(i); } - - + bool has_on_bounded_side(const Point_2 &p) const { return bounded_side(p) == ON_BOUNDED_SIDE; } - - + bool has_on_unbounded_side(const Point_2 &p) const { return bounded_side(p) == ON_UNBOUNDED_SIDE; } - - + bool has_on_boundary(const Point_2 &p) const { return bounded_side(p) == ON_BOUNDARY; } - - + bool has_on_negative_side(const Point_2 &p) const { return oriented_side(p) == ON_NEGATIVE_SIDE; } - - + bool has_on_positive_side(const Point_2 &p) const { return oriented_side(p) == ON_POSITIVE_SIDE; } - - + bool is_degenerate() const { return R().collinear_2_object()(vertex(0), vertex(1), vertex(2)); } - - + Bbox_2 bbox() const { return R().construct_bbox_2_object()(*this); } - - + Triangle_2 opposite() const { return R().construct_opposite_triangle_2_object()(*this); } - - Triangle_2 + + Triangle_2 transform(const Aff_transformation_2 &t) const { return Triangle_2(t.transform(vertex(0)), diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 0a247a27221..42de947c3f3 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -17,7 +17,7 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Andreas Fabri, Stefan Schirra @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -98,6 +99,12 @@ public: return R().is_degenerate_3_object()(*this); } + Bbox_3 + bbox() const + { + return R().construct_bbox_3_object()(*this); + } + FT squared_area() const // TODO : use Qrt { return R().compute_squared_area_3_object()(*this); diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_2.h index 83354128132..bb189bfc81b 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_circle_2.h @@ -14,14 +14,16 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL__TEST_CLS_CIRCLE_2_H #define CGAL__TEST_CLS_CIRCLE_2_H +#include + template bool _test_cls_circle_2(const R& ) @@ -61,7 +63,7 @@ _test_cls_circle_2(const R& ) CGAL::Circle_2 c1( p0, p1, p2); CGAL::Circle_2 c2( p0, p1, p3); CGAL::Circle_2 c3( p1, p0, p2); - CGAL::Circle_2 c4( p3, FT( n9 )); // n9 = (n6)^2 + const CGAL::Circle_2 c4( p3, FT( n9 )); // n9 = (n6)^2 CGAL::Vector_2 vx6 = vx * n6; CGAL::Vector_2 vy6 = vy * n6; CGAL::Circle_2 c5( p3 - vx6, p3 + vx6, p3 + vy6); @@ -172,7 +174,16 @@ _test_cls_circle_2(const R& ) assert( c12.is_degenerate() ); assert( c13.is_degenerate() ); + std::cout << '.'; + + CGAL::Bbox_2 bb = c4.bbox(); + assert(bb.xmin() <= -4.0); + assert(bb.xmax() >= 8.0); + assert(bb.ymin() <= -4.0); + assert(bb.ymax() >= 8.0); + std::cout << "done" << std::endl; return true; } + #endif // CGAL__TEST_CLS_CIRCLE_2_H diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_cuboid_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_cuboid_3.h index acc9be72443..14223c440ee 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_cuboid_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_cuboid_3.h @@ -14,14 +14,16 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL__TEST_CLS_ISO_CUBOID_3_H #define CGAL__TEST_CLS_ISO_CUBOID_3_H +#include + template bool _test_cls_iso_cuboid_3(const R& ) @@ -60,7 +62,7 @@ _test_cls_iso_cuboid_3(const R& ) CGAL::Point_3 p12(n1, n1, n3 ); // ( 1, 1, 3) CGAL::Point_3 p13(n4, n1, n3 ); // ( 4, 1, 3) - CGAL::Iso_cuboid_3 r1( p1, p3); + const CGAL::Iso_cuboid_3 r1( p1, p3); CGAL::Iso_cuboid_3 r1_( p1, p3, 0); CGAL::Iso_cuboid_3 r2( p3, p1); CGAL::Iso_cuboid_3 r3( p2, p5); @@ -162,6 +164,16 @@ _test_cls_iso_cuboid_3(const R& ) assert( r3.volume() == r4.volume() ); assert( r5.volume() == FT(84) ); + std::cout << '.'; + + CGAL::Bbox_3 bb = r1.bbox(); + assert(bb.xmin() <= 1.0); + assert(bb.xmax() >= 4.0); + assert(bb.ymin() <= 1.0); + assert(bb.ymax() >= 4.0); + assert(bb.zmin() <= 1.0); + assert(bb.zmax() >= 3.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_rectangle_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_rectangle_2.h index bc439c073d3..f17e6fad433 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_rectangle_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_iso_rectangle_2.h @@ -14,14 +14,16 @@ // // $URL$ // $Id$ -// +// // // Author(s) : Stefan Schirra - + #ifndef CGAL__TEST_CLS_ISO_RECTANGLE_2_H #define CGAL__TEST_CLS_ISO_RECTANGLE_2_H +#include + template bool _test_cls_iso_rectangle_2(const R& ) @@ -54,7 +56,7 @@ _test_cls_iso_rectangle_2(const R& ) CGAL::Point_2 p8( n4, n6, n2); // ( 2, 3) CGAL::Point_2 p9(-n3, n7); // (-3, 7) - CGAL::Iso_rectangle_2 r1( p1, p3); + const CGAL::Iso_rectangle_2 r1( p1, p3); CGAL::Iso_rectangle_2 r1_( p1, p3, 0); CGAL::Iso_rectangle_2 r2( p3, p1); CGAL::Iso_rectangle_2 r3( p2, p5); @@ -109,7 +111,7 @@ _test_cls_iso_rectangle_2(const R& ) assert( (r2.max)() == p3 ); std::cout << '.'; - + assert ( r1.min_coord(0) == r1.xmin() ); assert ( r1.min_coord(1) == r1.ymin() ); assert ( r2.max_coord(0) == r2.xmax() ); @@ -145,6 +147,14 @@ _test_cls_iso_rectangle_2(const R& ) assert( CGAL::Iso_rectangle_2( p1, p7 ).area() == FT(1) ); assert( CGAL::Iso_rectangle_2( p9, p3 ).area() == FT(21) ); + std::cout << '.'; + + CGAL::Bbox_2 bb = r1.bbox(); + assert(bb.xmin() <= 1.0); + assert(bb.xmax() >= 4.0); + assert(bb.ymin() <= 1.0); + assert(bb.ymax() >= 4.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h index 048e1bb4e0a..b878865134a 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_2.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_POINT_2_H #define CGAL__TEST_CLS_POINT_2_H +#include + template bool _test_cls_point_2(const R& ) @@ -158,6 +160,14 @@ _test_cls_point_2(const R& ) it2++; assert(it == it2); + std::cout << '.'; + + CGAL::Bbox_2 bb = p3.bbox(); + assert(bb.xmin() <= -35.0); + assert(bb.xmax() >= -35.0); + assert(bb.ymin() <= 50.0); + assert(bb.ymax() >= 50.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h index aa307b91db4..84e3671a84a 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_point_3.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_POINT_3_H #define CGAL__TEST_CLS_POINT_3_H +#include + template bool _test_cls_point_3(const R& ) @@ -170,6 +172,16 @@ _test_cls_point_3(const R& ) assert(it == it2); + std::cout << '.'; + + CGAL::Bbox_3 bb = p3.bbox(); + assert(bb.xmin() <= -35.0); + assert(bb.xmax() >= -35.0); + assert(bb.ymin() <= 50.0); + assert(bb.ymax() >= 50.0); + assert(bb.zmin() <= -20.0); + assert(bb.zmax() >= -20.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_2.h index cbe3258c8fd..65745dc1197 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_2.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_SEGMENT_2_H #define CGAL__TEST_CLS_SEGMENT_2_H +#include + template bool _test_cls_segment_2(const R& ) @@ -121,7 +123,16 @@ _test_cls_segment_2(const R& ) assert( CGAL::Segment_2( p3, p3).is_degenerate() ); + std::cout << '.'; + + CGAL::Bbox_2 bb = s1.bbox(); + assert(bb.xmin() <= 1.0); + assert(bb.xmax() >= 5.0); + assert(bb.ymin() <= 2.0); + assert(bb.ymax() >= 4.0); + std::cout << "done" << std::endl; return true; } + #endif // CGAL__TEST_CLS_SEGMENT_2_H diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h index 5aeebc0193f..d1c41c071c9 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_segment_3.h @@ -104,6 +104,16 @@ _test_cls_segment_3(const R& ) assert( sdeg.is_degenerate() ); assert( CGAL::parallel(sdeg, sdeg) ); + std::cout << '.'; + + CGAL::Bbox_3 bb = s2.bbox(); + assert(bb.xmin() <= -2.0); + assert(bb.xmax() >= 1.0); + assert(bb.ymin() <= 1.0); + assert(bb.ymax() >= 3.0); + assert(bb.zmin() <= 2.0); + assert(bb.zmax() >= 4.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h index ac68ef37003..b6e19fd4727 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_sphere_3.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_SPHERE_3_H #define CGAL__TEST_CLS_SPHERE_3_H +#include + template bool _test_cls_sphere_3(const R& ) @@ -61,7 +63,7 @@ _test_cls_sphere_3(const R& ) CGAL::Sphere_3 c1( p0, p1, p2, p4); CGAL::Sphere_3 c2( p0, p1, p3, p5); CGAL::Sphere_3 c3( p1, p0, p2, p4); - CGAL::Sphere_3 c4( p3, FT( n9 )); // n9 = (n6)^2 + const CGAL::Sphere_3 c4( p3, FT( n9 )); // n9 = (n6)^2 CGAL::Vector_3 vx6 = vx * n6; CGAL::Vector_3 vy6 = vy * n6; CGAL::Sphere_3 c5( p3 - vx6, p3 + vx6, p3 + vy6); @@ -228,6 +230,16 @@ _test_cls_sphere_3(const R& ) assert( c12.is_degenerate() ); assert( c13.is_degenerate() ); + std::cout << '.'; + + CGAL::Bbox_3 bb = c4.bbox(); + assert(bb.xmin() <= -4.0); + assert(bb.xmax() >= 8.0); + assert(bb.ymin() <= -4.0); + assert(bb.ymax() >= 8.0); + assert(bb.zmin() <= -4.0); + assert(bb.zmax() >= 8.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_tetrahedron_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_tetrahedron_3.h index 326bd7283dc..d257ab9f692 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_tetrahedron_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_tetrahedron_3.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_TETRAHEDRON_3_H #define CGAL__TEST_CLS_TETRAHEDRON_3_H +#include + template bool _test_cls_tetrahedron_3(const R& ) @@ -46,7 +48,7 @@ _test_cls_tetrahedron_3(const R& ) RT n9 = 8; CGAL::Point_3 p1( n1, n2, n3, n4); // (6, 8, -2) - CGAL::Point_3 p2( n2, n9, n3,-n3); // (4, -2, -1) + CGAL::Point_3 p2( n2, n9, n3,-n3); // (4, 2, -1) CGAL::Point_3 p3( n5, n6, n1, n5); // (1, 10, 4) CGAL::Point_3 p4( n7, n7, n8, n5); // (3, 3, 8) @@ -55,7 +57,7 @@ _test_cls_tetrahedron_3(const R& ) CGAL::Point_3 ps1( n7, n0, n0, n5); // (3, 0, 0) CGAL::Point_3 ps0( CGAL::ORIGIN ); // (0, 0, 0) - CGAL::Tetrahedron_3 t1(p1,p2,p3,p4); + const CGAL::Tetrahedron_3 t1(p1,p2,p3,p4); CGAL::Tetrahedron_3 t2(p2,p1,p3,p4); CGAL::Tetrahedron_3 t3(ps0,ps1,ps2,ps3); // positive oriented CGAL::Tetrahedron_3 t4(ps0,ps1,ps3,ps2); // negative oriented @@ -169,7 +171,18 @@ _test_cls_tetrahedron_3(const R& ) assert ( t9.volume() == FT(-288) ); assert ( CGAL::volume(ps0,p10,p11,p12) == FT(-288) ); + std::cout << '.'; + + CGAL::Bbox_3 bb = t1.bbox(); + assert(bb.xmin() <= 1.0); + assert(bb.xmax() >= 6.0); + assert(bb.ymin() <= 2.0); + assert(bb.ymax() >= 10.0); + assert(bb.zmin() <= -2.0); + assert(bb.zmax() >= 8.0); + std::cout << "done" << std::endl; return true; } + #endif // CGAL__TEST_CLS_TETRAHEDRON_3_H diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_2.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_2.h index 9a0bfeeab95..75661342880 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_2.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_2.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_TRIANGLE_2_H #define CGAL__TEST_CLS_TRIANGLE_2_H +#include + template bool _test_cls_triangle_2(const R& ) @@ -140,6 +142,14 @@ _test_cls_triangle_2(const R& ) assert ( t2.area() == -t5.area() ); assert ( t3.area() == FT(5) ); + std::cout << '.'; + + CGAL::Bbox_2 bb = t1.bbox(); + assert(bb.xmin() <= 1.0); + assert(bb.xmax() >= 7.0); + assert(bb.ymin() <= 1.0); + assert(bb.ymax() >= 5.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_3.h index 559fa7228a5..51163df16f5 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_cls_triangle_3.h @@ -22,6 +22,8 @@ #ifndef CGAL__TEST_CLS_TRIANGLE_3_H #define CGAL__TEST_CLS_TRIANGLE_3_H +#include + template bool _test_cls_triangle_3(const R& ) @@ -46,7 +48,7 @@ _test_cls_triangle_3(const R& ) RT n9 = 8; CGAL::Point_3 p1( n1, n2, n3, n4); // (6, 8, -2) - CGAL::Point_3 p2( n2, n9, n3,-n3); // (-4, 2, -1) + CGAL::Point_3 p2( n2, n9, n3,-n3); // (4, 2, -1) CGAL::Point_3 p3( n5, n6, n1, n5); // (1, 10, 4) CGAL::Point_3 p4( n7, n7, n8, n5); // (3, 3, 6) CGAL::Point_3 p5( n2, n1, n0, n4); // (8, 6, 0) @@ -56,7 +58,7 @@ _test_cls_triangle_3(const R& ) CGAL::Point_3 ps2( n0, n7, n0, n5); // (0, 3, 0) CGAL::Point_3 ps1( n7, n0, n0, n5); // (3, 0, 0) - CGAL::Triangle_3 t1(p1,p2,p3); + const CGAL::Triangle_3 t1(p1,p2,p3); CGAL::Triangle_3 t2(p4,p2,p3); CGAL::Triangle_3 t3(ps1,ps2,ps3); CGAL::Triangle_3 t4(ps2,ps1,ps3); @@ -111,6 +113,16 @@ _test_cls_triangle_3(const R& ) assert ( t6.squared_area() == FT(25) ); assert ( t6.squared_area() == CGAL::squared_area(ps3,p5,p6) ); + std::cout << '.'; + + CGAL::Bbox_3 bb = t1.bbox(); + assert(bb.xmin() <= 1.0); + assert(bb.xmax() >= 6.0); + assert(bb.ymin() <= 2.0); + assert(bb.ymax() >= 10.0); + assert(bb.zmin() <= -2.0); + assert(bb.zmax() >= 4.0); + std::cout << "done" << std::endl; return true; } diff --git a/Kernel_23/test/Kernel_23/makefile b/Kernel_23/test/Kernel_23/makefile index ff171db076a..263296b981a 100644 --- a/Kernel_23/test/Kernel_23/makefile +++ b/Kernel_23/test/Kernel_23/makefile @@ -21,6 +21,8 @@ CXXFLAGS = \ -I../../../Filtered_kernel/include \ -I../../../Cartesian_kernel/include \ -I../../../Homogeneous_kernel/include \ + -I../../../STL_Extension/include \ + -I../../../Timer/include \ $(TESTSUITE_CXXFLAGS) \ $(EXTRA_FLAGS) \ $(CGAL_CXXFLAGS) \