diff --git a/AABB_tree/include/CGAL/AABB_tree/AABB_node.h b/AABB_tree/include/CGAL/AABB_tree/AABB_node.h index 421a2d77a29..cc2b422eeee 100644 --- a/AABB_tree/include/CGAL/AABB_tree/AABB_node.h +++ b/AABB_tree/include/CGAL/AABB_tree/AABB_node.h @@ -16,7 +16,7 @@ // $Id$ // // -// Author(s) : Camille Wormser, Pierre Alliez +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez #ifndef CGAL_AABB_NODE_H #define CGAL_AABB_NODE_H @@ -32,7 +32,6 @@ #include "Plane_3_Bbox_3_do_intersect.h" #include "Triangle_3_Bbox_3_do_intersect.h" #include "Line_3_Bbox_3_do_intersect.h" -#include "Plucker_ray_3_Bbox_3_do_intersect.h" #include "Sphere_3_Bbox_do_intersect.h" CGAL_BEGIN_NAMESPACE diff --git a/AABB_tree/include/CGAL/AABB_tree/AABB_polyhedral_oracle.h b/AABB_tree/include/CGAL/AABB_tree/AABB_polyhedral_oracle.h index e3dd41bc520..9e481a938d0 100644 --- a/AABB_tree/include/CGAL/AABB_tree/AABB_polyhedral_oracle.h +++ b/AABB_tree/include/CGAL/AABB_tree/AABB_polyhedral_oracle.h @@ -135,7 +135,7 @@ public: int n) const { // TODO (with visitor) - // std::cout << "construct initial point set" << std::endl; + std::cout << "AABB_polyhedral_oracle: construct initial point set not implemented" << std::endl; // *out++= p; return out; } @@ -149,7 +149,7 @@ public: template bool is_in_volume(const Surface_3& surface, const P& p) { - std::cout << "DEBUG: call is in volume" << std::endl; + std::cout << "call is in volume: empty function" << std::endl; return true; } }; // end class AABB_polyhedral_oracle diff --git a/AABB_tree/include/CGAL/AABB_tree/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree/AABB_tree.h index ccdcd12593f..315a029f8cd 100644 --- a/AABB_tree/include/CGAL/AABB_tree/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree/AABB_tree.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Camille Wormser, Pierre Alliez +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez #ifndef CGAL_AABB_TREE_H #define CGAL_AABB_TREE_H @@ -23,7 +23,6 @@ #include #include #include "AABB_node.h" -#include "knn.h" CGAL_BEGIN_NAMESPACE @@ -46,8 +45,6 @@ public: typedef AABB_node Node; typedef typename Node::Point_with_input Point_with_input; - // types for K nearest neighbors search structure - typedef CNeighbor_search Neighbor_search; private: diff --git a/AABB_tree/include/CGAL/AABB_tree/Bbox_3_Bbox_3_do_intersect.h b/AABB_tree/include/CGAL/AABB_tree/Bbox_3_Bbox_3_do_intersect.h index f8752c026cb..8eefd0d9e37 100644 --- a/AABB_tree/include/CGAL/AABB_tree/Bbox_3_Bbox_3_do_intersect.h +++ b/AABB_tree/include/CGAL/AABB_tree/Bbox_3_Bbox_3_do_intersect.h @@ -20,8 +20,6 @@ #ifndef CGAL_BBOX_3_BBOX_3_DO_INTERSECT_H #define CGAL_BBOX_3_BBOX_3_DO_INTERSECT_H -//#include - CGAL_BEGIN_NAMESPACE #undef min diff --git a/AABB_tree/include/CGAL/AABB_tree/Plucker_ray_3_Bbox_3_do_intersect.h b/AABB_tree/include/CGAL/AABB_tree/Plucker_ray_3_Bbox_3_do_intersect.h deleted file mode 100644 index 2a98e2818cf..00000000000 --- a/AABB_tree/include/CGAL/AABB_tree/Plucker_ray_3_Bbox_3_do_intersect.h +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETHZ (Suisse). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Camille Wormser, Pierre Alliez - -#ifndef CGAL_PLUCKER_RAY_3_BBOX_3_DO_INTERSECT_H -#define CGAL_PLUCKER_RAY_3_BBOX_3_DO_INTERSECT_H - -CGAL_BEGIN_NAMESPACE - -template -bool do_intersect_type_0(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero < xmin || ftzero < ymin || ftzero < zmin) - return false; - - //if it lies on correct side of the silhouette(6 edges) then it intersects - //MM* - if((diry*xmax) > (dirx*ymin))//DH - return false; - if((diry*xmin) < (dirx*ymax))//BF - return false; - - //*MM - if((diry*zmax) > (dirz*ymin))//HE - return false; - if((diry*zmin) < (dirz*ymax))//CB - return false; - - //M*M - if((dirx*zmax) > (dirz*xmin))//EF - return false; - if((dirx*zmin) < (dirz*xmax))//DC - return false; - - return true; -} - - -template -bool do_intersect_type_1(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero < xmin || ftzero < ymin || ftzero > zmax) - return false; - - //MM* - if((diry*xmax) > (dirx*ymin))//DH - return false; - if((diry*xmin) < (dirx*ymax))//BF - return false; - - //*MP - if((diry*zmax) > (dirz*ymax))//GF - return false; - if((diry*zmin) < (dirz*ymin))//DA - return false; - - //M*P - if((dirx*zmax) > (dirz*xmax))//HG - return false; - if((dirx*zmin) < (dirz*xmin))//AB - return false; - - return true; -} - -template -bool do_intersect_type_2(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero < xmin || ftzero > ymax || ftzero < zmin) - return false; - - //MP* - if((diry*xmax) < (dirx*ymax))//CG - return false; - if((diry*xmin) > (dirx*ymin))//AE - return false; - - //*PM - if((diry*zmax) < (dirz*ymax))//GF - return false; - if((diry*zmin) > (dirz*ymin))//DA - return false; - - //M*M - if((dirx*zmax) > (dirz*xmin))//EF - return false; - if((dirx*zmin) < (dirz*xmax))//DC - return false; - - return true; -} - -template -bool do_intersect_type_3(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero < xmin || ftzero > ymax || ftzero > zmax) - return false; - - //MP* - if((diry*xmax) < (dirx*ymax))//CG - return false; - if((diry*xmin) > (dirx*ymin))//AE - return false; - - //*PP - if((diry*zmax) < (dirz*ymin))//HE - return false; - if((diry*zmin) > (dirz*ymax))//CB - return false; - - //M*P - if((dirx*zmax) > (dirz*xmax))//HG - return false; - if((dirx*zmin) < (dirz*xmin))//AB - return false; - - return true; -} - -template -bool do_intersect_type_4(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero > xmax || ftzero < ymin || ftzero < zmin) - return false; - - //PM* - if((diry*xmax) > (dirx*ymax))//CG - return false; - if((diry*xmin) < (dirx*ymin))//AE - return false; - - //*MM - if((diry*zmax) > (dirz*ymin))//HE - return false; - if((diry*zmin) < (dirz*ymax))//CB - return false; - - //P*M - if((dirx*zmax) < (dirz*xmax))//HG - return false; - if((dirx*zmin) > (dirz*xmin))//AB - return false; - - return true; -} - -template -bool do_intersect_type_5(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero > xmax || ftzero < ymin || ftzero > zmax) - return false; - - //PM* - if((diry*xmax) > (dirx*ymax))//CG - return false; - if((diry*xmin) < (dirx*ymin))//AE - return false; - - //*MP - if((diry*zmax) > (dirz*ymax))//GF - return false; - if((diry*zmin) < (dirz*ymin))//DA - return false; - - //P*P; - if((dirx*zmax) < (dirz*xmin))//EF - return false; - if((dirx*zmin) > (dirz*xmax))//DC - return false; - - return true; -} - -template -bool do_intersect_type_6(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero > xmax || ftzero > ymax || ftzero < zmin) - return false; - - //PP* - if((diry*xmax) < (dirx*ymin))//DH - return false; - if((diry*xmin) > (dirx*ymax))//BF - return false; - - //*PM - if((diry*zmax) < (dirz*ymax))//GF - return false; - if((diry*zmin) > (dirz*ymin))//DA - return false; - - //P*M - if((dirx*zmax) < (dirz*xmax))//HG - return false; - if((dirx*zmin) > (dirz*xmin))//AB - return false; - - return true; -} - -template -bool do_intersect_type_7(const typename K::Ray_3& ray, - const CGAL::Bbox_3& bbox) -{ - typedef typename K::FT FT; - typedef typename K::Point_3 Point; - typedef typename K::Vector_3 Vector; - typedef typename K::Ray_3 Ray; - - const Point source = ray.source(); - - const FT xmin = bbox.xmin()-source.x(); - const FT xmax = bbox.xmax()-source.x(); - const FT ymin = bbox.ymin()-source.y(); - const FT ymax = bbox.ymax()-source.y(); - const FT zmin = bbox.zmin()-source.z(); - const FT zmax = bbox.zmax()-source.z(); - - const Vector direction1 = ray.to_vector(); - - const FT dirx = direction1.x(); - const FT diry = direction1.y(); - const FT dirz = direction1.z(); - - const FT ftzero = (FT)0.0; - - if(ftzero > xmax || ftzero > ymax || ftzero > zmax) - return false; - - //PP* - if((diry*xmax) < (dirx*ymin))//DH - return false; - if((diry*xmin) > (dirx*ymax))//BF - return false; - - //*PP - if((diry*zmax) < (dirz*ymin))//HE - return false; - if((diry*zmin) > (dirz*ymax))//CB - return false; - - //P*P - if((dirx*zmax) < (dirz*xmin))//EF - return false; - if((dirx*zmin) > (dirz*xmax))//DC - return false; - - return true; -} - - -CGAL_END_NAMESPACE - -#endif // CGAL_PLUCKER_RAY_3_BBOX_3_DO_INTERSECT_H diff --git a/AABB_tree/include/CGAL/AABB_tree/Ray_3_Bbox_3_do_intersect.h b/AABB_tree/include/CGAL/AABB_tree/Ray_3_Bbox_3_do_intersect.h index fb17b09a245..93383b46c3f 100644 --- a/AABB_tree/include/CGAL/AABB_tree/Ray_3_Bbox_3_do_intersect.h +++ b/AABB_tree/include/CGAL/AABB_tree/Ray_3_Bbox_3_do_intersect.h @@ -94,7 +94,6 @@ bool do_intersect(const CGAL::Ray_3& ray, const CGAL::Bbox_3& bbox) { return CGALi::do_intersect(ray, bbox, K()); -// return typename K::Do_intersect_3()(ray, bbox); } template @@ -102,10 +101,8 @@ bool do_intersect(const CGAL::Bbox_3& bbox, const CGAL::Ray_3& ray) { return CGALi::do_intersect(ray, bbox, K()); -// return typename K::Do_intersect_3()(ray, bbox); } - CGAL_END_NAMESPACE #endif // CGAL_RAY_3_BBOX_3_DO_INTERSECT_H diff --git a/AABB_tree/include/CGAL/AABB_tree/Segment_3_Bbox_3_do_intersect.h b/AABB_tree/include/CGAL/AABB_tree/Segment_3_Bbox_3_do_intersect.h index 2d44be5cb8b..78a318a8c5e 100644 --- a/AABB_tree/include/CGAL/AABB_tree/Segment_3_Bbox_3_do_intersect.h +++ b/AABB_tree/include/CGAL/AABB_tree/Segment_3_Bbox_3_do_intersect.h @@ -39,9 +39,6 @@ namespace CGALi { typedef typename K::Vector_3 Vector; typedef typename K::Segment_3 Segment; - //tried checking whether point is inside the box, but that significantly reduces performance - //bbox-bbox(segment) without precomputing also reduces performance - Point parameters[2]; parameters[0] = Point(bbox.xmin(), bbox.ymin(), bbox.zmin()); parameters[1] = Point(bbox.xmax(), bbox.ymax(), bbox.zmax()); @@ -61,9 +58,10 @@ namespace CGALi { FT tmin = (parameters[sign_x].x() - source.x()) * inv_direction.x(); FT tmax = (parameters[1-sign_x].x() - source.x()) * inv_direction.x(); - //faster exit - thanks to camille + // faster exit if(tmax < (FT)0.0 || tmin > (FT)1.0) return false; + if(tmin < (FT)0.0) tmin = (FT)0.0; if(tmax > (FT)1.0) @@ -97,7 +95,6 @@ bool do_intersect(const CGAL::Segment_3& segment, const CGAL::Bbox_3& bbox) { return CGALi::do_intersect(segment, bbox, K()); -// return typename K::Do_intersect_3()(segment, bbox); } template @@ -105,10 +102,8 @@ bool do_intersect(const CGAL::Bbox_3& bbox, const CGAL::Segment_3& segment) { return CGALi::do_intersect(segment, bbox, K()); -// return typename K::Do_intersect_3()(segment, bbox); } - CGAL_END_NAMESPACE #endif // CGAL_SEGMENT_3_BBOX_3_DO_INTERSECT_H diff --git a/AABB_tree/include/CGAL/AABB_tree/knn.h b/AABB_tree/include/CGAL/AABB_tree/knn.h deleted file mode 100644 index 2f47aad4a80..00000000000 --- a/AABB_tree/include/CGAL/AABB_tree/knn.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETHZ (Suisse). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// -// -// Author(s) : Camille Wormser, Pierre Alliez - -/* - -USAGE - -typedef CNeighbor_search Neighbor_search; -Neighbor_search search; - -std::list points; -search.init(points); - -// query -Point p = nearest_point(query); - -*/ - -#ifndef _NEIGHBOR_SEARCH_ -#define _NEIGHBOR_SEARCH_ -#include -#include -#include - -template -class CNeighbor_search -{ -public: - typedef typename kernel::FT FT; - typedef typename kernel::Point_3 Point; - typedef typename CGAL::Search_traits_3 TreeTraits; - typedef typename CGAL::Orthogonal_k_neighbor_search Neighbor_search; - typedef typename Neighbor_search::Tree Tree; - -private: - Tree m_tree; - -public: - CNeighbor_search() {} - ~CNeighbor_search() {} - - void init(const std::list& points) - { - m_tree = Tree(points.begin(),points.end()); - } - - FT distance_nearest_point(const Point& query) - { - Neighbor_search search(m_tree,query,1); // only first nearest neighbor - return (FT)std::sqrt(CGAL_NTS to_double(search.begin()->second)); - } - - Point nearest_point(const Point& query) - { - Neighbor_search search(m_tree,query,1); // only first nearest neighbor - return search.begin()->first; - } -}; -#endif // _NEIGHBOR_SEARCH_ -