Merge pull request #1833 from sloriot/AABB_tree-fix_ray_shooting

Fix a typo for computing the relative distance
This commit is contained in:
Laurent Rineau 2017-01-18 19:25:55 +01:00 committed by GitHub
commit 4b066f6586
2 changed files with 6 additions and 4 deletions

View File

@ -34,7 +34,7 @@ struct Skip {
bool operator()(const face_descriptor& t) const
{ if(t == fd){
std::cerr << "ignore" << t <<std::endl;
std::cerr << "ignore " << t <<std::endl;
};
return(t == fd);
}
@ -59,7 +59,8 @@ int main(int argc, char* argv[])
Vector v = CGAL::Polygon_mesh_processing::compute_face_normal(fd,mesh);
Ray ray(p,d * v);
Ray_intersection intersection = tree.first_intersection(ray);
Skip skip(fd);
Ray_intersection intersection = tree.first_intersection(ray, skip);
if(intersection){
if(boost::get<Point>(&(intersection->first))){
const Point* p = boost::get<Point>(&(intersection->first) );

View File

@ -187,10 +187,11 @@ private:
typename AABB_traits::Geom_traits::Vector_3 v = ray->to_vector();
for(int i = 0; i < 3; ++i) {
if(v[0] != FT(0.)) {
return x[0] / v[0];
if(v[i] != FT(0.)) {
return x[i] / v[i];
}
}
CGAL_assertion(false); // should never end-up here
return FT(0.);
}