mirror of https://github.com/CGAL/cgal
AABB tree: remove knn and plucker. a bit of cleanup and update of authors.
This commit is contained in:
parent
a9ff741545
commit
d0bf3a2245
|
|
@ -16,7 +16,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Camille Wormser, Pierre Alliez
|
// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez
|
||||||
|
|
||||||
#ifndef CGAL_AABB_NODE_H
|
#ifndef CGAL_AABB_NODE_H
|
||||||
#define CGAL_AABB_NODE_H
|
#define CGAL_AABB_NODE_H
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
#include "Plane_3_Bbox_3_do_intersect.h"
|
#include "Plane_3_Bbox_3_do_intersect.h"
|
||||||
#include "Triangle_3_Bbox_3_do_intersect.h"
|
#include "Triangle_3_Bbox_3_do_intersect.h"
|
||||||
#include "Line_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"
|
#include "Sphere_3_Bbox_do_intersect.h"
|
||||||
|
|
||||||
CGAL_BEGIN_NAMESPACE
|
CGAL_BEGIN_NAMESPACE
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ public:
|
||||||
int n) const
|
int n) const
|
||||||
{
|
{
|
||||||
// TODO (with visitor)
|
// 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;
|
// *out++= p;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +149,7 @@ public:
|
||||||
template <class P>
|
template <class P>
|
||||||
bool is_in_volume(const Surface_3& surface, const P& p)
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}; // end class AABB_polyhedral_oracle
|
}; // end class AABB_polyhedral_oracle
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author(s) : Camille Wormser, Pierre Alliez
|
// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez
|
||||||
|
|
||||||
#ifndef CGAL_AABB_TREE_H
|
#ifndef CGAL_AABB_TREE_H
|
||||||
#define CGAL_AABB_TREE_H
|
#define CGAL_AABB_TREE_H
|
||||||
|
|
@ -23,7 +23,6 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include "AABB_node.h"
|
#include "AABB_node.h"
|
||||||
#include "knn.h"
|
|
||||||
|
|
||||||
CGAL_BEGIN_NAMESPACE
|
CGAL_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
@ -46,8 +45,6 @@ public:
|
||||||
typedef AABB_node<Kernel,Input,PSC> Node;
|
typedef AABB_node<Kernel,Input,PSC> Node;
|
||||||
typedef typename Node::Point_with_input Point_with_input;
|
typedef typename Node::Point_with_input Point_with_input;
|
||||||
|
|
||||||
// types for K nearest neighbors search structure
|
|
||||||
typedef CNeighbor_search<Kernel> Neighbor_search;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@
|
||||||
#ifndef CGAL_BBOX_3_BBOX_3_DO_INTERSECT_H
|
#ifndef CGAL_BBOX_3_BBOX_3_DO_INTERSECT_H
|
||||||
#define CGAL_BBOX_3_BBOX_3_DO_INTERSECT_H
|
#define CGAL_BBOX_3_BBOX_3_DO_INTERSECT_H
|
||||||
|
|
||||||
//#include <CGAL/number_utils.h>
|
|
||||||
|
|
||||||
CGAL_BEGIN_NAMESPACE
|
CGAL_BEGIN_NAMESPACE
|
||||||
|
|
||||||
#undef min
|
#undef min
|
||||||
|
|
|
||||||
|
|
@ -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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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 <class K>
|
|
||||||
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
|
|
||||||
|
|
@ -94,7 +94,6 @@ bool do_intersect(const CGAL::Ray_3<K>& ray,
|
||||||
const CGAL::Bbox_3& bbox)
|
const CGAL::Bbox_3& bbox)
|
||||||
{
|
{
|
||||||
return CGALi::do_intersect(ray, bbox, K());
|
return CGALi::do_intersect(ray, bbox, K());
|
||||||
// return typename K::Do_intersect_3()(ray, bbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
|
|
@ -102,10 +101,8 @@ bool do_intersect(const CGAL::Bbox_3& bbox,
|
||||||
const CGAL::Ray_3<K>& ray)
|
const CGAL::Ray_3<K>& ray)
|
||||||
{
|
{
|
||||||
return CGALi::do_intersect(ray, bbox, K());
|
return CGALi::do_intersect(ray, bbox, K());
|
||||||
// return typename K::Do_intersect_3()(ray, bbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CGAL_END_NAMESPACE
|
CGAL_END_NAMESPACE
|
||||||
|
|
||||||
#endif // CGAL_RAY_3_BBOX_3_DO_INTERSECT_H
|
#endif // CGAL_RAY_3_BBOX_3_DO_INTERSECT_H
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,6 @@ namespace CGALi {
|
||||||
typedef typename K::Vector_3 Vector;
|
typedef typename K::Vector_3 Vector;
|
||||||
typedef typename K::Segment_3 Segment;
|
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];
|
Point parameters[2];
|
||||||
parameters[0] = Point(bbox.xmin(), bbox.ymin(), bbox.zmin());
|
parameters[0] = Point(bbox.xmin(), bbox.ymin(), bbox.zmin());
|
||||||
parameters[1] = Point(bbox.xmax(), bbox.ymax(), bbox.zmax());
|
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 tmin = (parameters[sign_x].x() - source.x()) * inv_direction.x();
|
||||||
FT tmax = (parameters[1-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)
|
if(tmax < (FT)0.0 || tmin > (FT)1.0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(tmin < (FT)0.0)
|
if(tmin < (FT)0.0)
|
||||||
tmin = (FT)0.0;
|
tmin = (FT)0.0;
|
||||||
if(tmax > (FT)1.0)
|
if(tmax > (FT)1.0)
|
||||||
|
|
@ -97,7 +95,6 @@ bool do_intersect(const CGAL::Segment_3<K>& segment,
|
||||||
const CGAL::Bbox_3& bbox)
|
const CGAL::Bbox_3& bbox)
|
||||||
{
|
{
|
||||||
return CGALi::do_intersect(segment, bbox, K());
|
return CGALi::do_intersect(segment, bbox, K());
|
||||||
// return typename K::Do_intersect_3()(segment, bbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
|
|
@ -105,10 +102,8 @@ bool do_intersect(const CGAL::Bbox_3& bbox,
|
||||||
const CGAL::Segment_3<K>& segment)
|
const CGAL::Segment_3<K>& segment)
|
||||||
{
|
{
|
||||||
return CGALi::do_intersect(segment, bbox, K());
|
return CGALi::do_intersect(segment, bbox, K());
|
||||||
// return typename K::Do_intersect_3()(segment, bbox);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CGAL_END_NAMESPACE
|
CGAL_END_NAMESPACE
|
||||||
|
|
||||||
#endif // CGAL_SEGMENT_3_BBOX_3_DO_INTERSECT_H
|
#endif // CGAL_SEGMENT_3_BBOX_3_DO_INTERSECT_H
|
||||||
|
|
|
||||||
|
|
@ -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<kernel> Neighbor_search;
|
|
||||||
Neighbor_search search;
|
|
||||||
|
|
||||||
std::list<Point> points;
|
|
||||||
search.init(points);
|
|
||||||
|
|
||||||
// query
|
|
||||||
Point p = nearest_point(query);
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _NEIGHBOR_SEARCH_
|
|
||||||
#define _NEIGHBOR_SEARCH_
|
|
||||||
#include <CGAL/Orthogonal_k_neighbor_search.h>
|
|
||||||
#include <CGAL/Search_traits_3.h>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
template <class kernel>
|
|
||||||
class CNeighbor_search
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef typename kernel::FT FT;
|
|
||||||
typedef typename kernel::Point_3 Point;
|
|
||||||
typedef typename CGAL::Search_traits_3<kernel> TreeTraits;
|
|
||||||
typedef typename CGAL::Orthogonal_k_neighbor_search<TreeTraits> Neighbor_search;
|
|
||||||
typedef typename Neighbor_search::Tree Tree;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Tree m_tree;
|
|
||||||
|
|
||||||
public:
|
|
||||||
CNeighbor_search() {}
|
|
||||||
~CNeighbor_search() {}
|
|
||||||
|
|
||||||
void init(const std::list<Point>& 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_
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue