mirror of https://github.com/CGAL/cgal
Avoid filter failure in ray shoot facet
This commit is contained in:
parent
0dfa8a4941
commit
04f7b8d7b9
|
|
@ -218,6 +218,22 @@ public:
|
||||||
delete candidate_provider;
|
delete candidate_provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We next check if v is a vertex on the face to avoid a geometric test
|
||||||
|
static inline bool v_vertex_of_f(Vertex_handle v, Halffacet_handle f) {
|
||||||
|
Halffacet_cycle_iterator fci;
|
||||||
|
for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) {
|
||||||
|
if(fci.is_shalfedge()) {
|
||||||
|
SHalfedge_around_facet_circulator sfc(fci), send(sfc);
|
||||||
|
CGAL_For_all(sfc,send) {
|
||||||
|
if(sfc->source()->center_vertex() == v){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
virtual Object_handle shoot(const Ray_3& ray, int mask=255) const {
|
virtual Object_handle shoot(const Ray_3& ray, int mask=255) const {
|
||||||
Vertex_handle null_handle;
|
Vertex_handle null_handle;
|
||||||
return this->shoot(ray, null_handle, mask);
|
return this->shoot(ray, null_handle, mask);
|
||||||
|
|
@ -282,6 +298,7 @@ public:
|
||||||
Point_3 q;
|
Point_3 q;
|
||||||
_CGAL_NEF_TRACEN("trying facet with on plane "<<f->plane()<<
|
_CGAL_NEF_TRACEN("trying facet with on plane "<<f->plane()<<
|
||||||
" with point on "<<f->plane().point());
|
" with point on "<<f->plane().point());
|
||||||
|
if( (ray_source_vertex == Vertex_handle()) || !v_vertex_of_f(ray_source_vertex,f) ) {
|
||||||
if( SNC_intersection::does_intersect_internally( ray, f, q) ) {
|
if( SNC_intersection::does_intersect_internally( ray, f, q) ) {
|
||||||
_CGAL_NEF_TRACEN("ray intersects facet on "<<q);
|
_CGAL_NEF_TRACEN("ray intersects facet on "<<q);
|
||||||
_CGAL_NEF_TRACEN("prev. intersection? "<<hit);
|
_CGAL_NEF_TRACEN("prev. intersection? "<<hit);
|
||||||
|
|
@ -298,6 +315,7 @@ public:
|
||||||
_CGAL_NEF_TRACEN("the facet becomes the new hit object");
|
_CGAL_NEF_TRACEN("the facet becomes the new hit object");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if((mask&15) == 15)
|
else if((mask&15) == 15)
|
||||||
CGAL_error_msg( "wrong handle");
|
CGAL_error_msg( "wrong handle");
|
||||||
}
|
}
|
||||||
|
|
@ -443,23 +461,7 @@ public:
|
||||||
return make_object(f);
|
return make_object(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We next check if v is a vertex on the face to avoid a geometric test
|
if( !v_vertex_of_f(v,f) && SNC_intersection::does_intersect_internally(s,f,ip) ) {
|
||||||
bool v_vertex_of_f = false;
|
|
||||||
Halffacet_cycle_iterator fci;
|
|
||||||
for(fci=f->facet_cycles_begin(); (! v_vertex_of_f) && (fci!=f->facet_cycles_end()); ++fci) {
|
|
||||||
if(fci.is_shalfedge()) {
|
|
||||||
SHalfedge_around_facet_circulator sfc(fci), send(sfc);
|
|
||||||
CGAL_For_all(sfc,send) {
|
|
||||||
if(sfc->source()->center_vertex() == v){
|
|
||||||
v_vertex_of_f = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if( (! v_vertex_of_f) && SNC_intersection::does_intersect_internally(s,f,ip) ) {
|
|
||||||
s = Segment_3(p, normalized(ip));
|
s = Segment_3(p, normalized(ip));
|
||||||
result = make_object(f);
|
result = make_object(f);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue