Pass the bbox as argument instead of the six coordinates

That increased the perfs! :-)
This commit is contained in:
Laurent Rineau 2012-06-14 17:04:35 +00:00
parent 503d441f1e
commit a72bd80380
4 changed files with 27 additions and 25 deletions

View File

@ -126,8 +126,7 @@ public:
do_intersect_bbox_segment_aux<double, true, true, true>
(px, py, pz,
qx, qy, qz,
bxmin, bymin, bzmin,
bxmax, bymax, bzmax);
b);
if(is_indeterminate(ub)) return Base::operator()(s,b);
else return ub.sup();

View File

@ -139,8 +139,7 @@ namespace internal {
return do_intersect_bbox_segment_aux<FT, true, false, false>(
source.x(), source.y(), source.z(),
point_on_ray.x(), point_on_ray.y(), point_on_ray.z(),
bbox.xmin(), bbox.ymin(), bbox.zmin(),
bbox.xmax(), bbox.ymax(), bbox.zmax() );
bbox);
// const CGAL::cpp0x::array<FT, 6> rray = {source.x(), source.y(), source.z(),
// point_on_ray.x(), point_on_ray.y(), point_on_ray.z() };
// return do_intersect_bbox_segment_aux<FT, true, false>

View File

@ -122,9 +122,15 @@ namespace internal {
do_intersect_bbox_segment_aux(
const FT& px, const FT& py, const FT& pz,
const FT& qx, const FT& qy, const FT& qz,
const double& bxmin, const double& bymin, const double& bzmin,
const double& bxmax, const double& bymax, const double& bzmax)
const Bbox_3& bbox)
{
const double& bxmin = bbox.xmin();
const double& bymin = bbox.ymin();
const double& bzmin = bbox.zmin();
const double& bxmax = bbox.xmax();
const double& bymax = bbox.ymax();
const double& bzmax = bbox.zmax();
// The following code encode t1 and t2 by:
// t1 = tmin/dmin
// t2 = tmax/dmax
@ -447,8 +453,9 @@ namespace internal {
return do_intersect_bbox_segment_aux<FT, true, true, false>(
source.x(), source.y(), source.z(),
target.x(), target.y(), target.z(),
bbox.xmin(), bbox.ymin(), bbox.zmin(),
bbox.xmax(), bbox.ymax(), bbox.zmax() );
bbox);
// bbox.xmin(), bbox.ymin(), bbox.zmin(),
// bbox.xmax(), bbox.ymax(), bbox.zmax() );
// const CGAL::cpp0x::array<FT, 6> seg = {source.x(), source.y(), source.z(),
// target.x(), target.y(), target.z() };

View File

@ -67,7 +67,7 @@ bool test_aux(const T& t,
bool b = CGAL::do_intersect(t,bbox);
if ( b != expected )
std::cout << "ERROR: do_intersect(" << name
std::cerr << "ERROR: do_intersect(" << name
<< ") did not answer the expected result !" << std::endl;
return (b == expected);
@ -674,27 +674,24 @@ int main()
std::cout << std::setprecision(5);
bool b;
// std::cout << "Testing with Simple_cartesian<float>..." << std::endl ;
// b = test_kernel<CGAL::Simple_cartesian<float> >(false);
std::cout << "Testing with Simple_cartesian<float>..." << std::endl ;
b = test_kernel<CGAL::Simple_cartesian<float> >(false);
// std::cout << std::endl << "Testing with Simple_cartesian<double>..." << std::endl ;
// b &= test_kernel<CGAL::Simple_cartesian<double> >(true);
std::cout << std::endl << "Testing with Simple_cartesian<double>..." << std::endl ;
b &= test_kernel<CGAL::Simple_cartesian<double> >(true);
// std::cout << std::endl << "Testing with Simple_cartesian<Gmpq>..." << std::endl ;
// b &= test<CGAL::Simple_cartesian<CGAL::Gmpq> >(true);
// test_speed<CGAL::Simple_cartesian<CGAL::Gmpq> >();
std::cout << std::endl << "Testing with Simple_cartesian<Gmpq>..." << std::endl ;
b &= test_kernel<CGAL::Simple_cartesian<CGAL::Gmpq> >(true);
// std::cout << std::endl << "Testing with Cartesian<float>..." << std::endl ;
// b &= test<CGAL::Cartesian<float> >(false);
// test_speed<CGAL::Cartesian<float> >();
std::cout << std::endl << "Testing with Cartesian<float>..." << std::endl ;
b &= test_kernel<CGAL::Cartesian<float> >(false);
// std::cout << std::endl << "Testing with Cartesian<double>..." << std::endl ;
// b &= test_kernel<CGAL::Cartesian<double> >(true);
std::cout << std::endl << "Testing with Cartesian<double>..." << std::endl ;
b &= test_kernel<CGAL::Cartesian<double> >(true);
// std::cout << std::endl << "Testing with Filtered_kernel<Simple_cartesian<double> > without static filters..." << std::endl ;
// typedef CGAL::Filtered_kernel<CGAL::Simple_cartesian<double>, false> Fk_no_static;
// b &= test_kernel<Fk_no_static>();
// test_speed<Fk_no_static>();
std::cout << std::endl << "Testing with Filtered_kernel<Simple_cartesian<double> > without static filters..." << std::endl ;
typedef CGAL::Filtered_kernel<CGAL::Simple_cartesian<double>, false> Fk_no_static;
b &= test_kernel<Fk_no_static>();
std::cout << std::endl << "Testing with Exact_predicates_inexact_constructions_kernel..." << std::endl ;
b &= test_kernel<CGAL::Exact_predicates_inexact_constructions_kernel>();