Nef_3: Avoid geometric test

This commit is contained in:
Andreas Fabri 2022-03-18 15:39:41 +01:00
parent c837828770
commit f09f38c3f2
2 changed files with 24 additions and 20 deletions

View File

@ -914,7 +914,7 @@ public:
number_of_ray_shooting_queries++;
timer_ray_shooting.start();
#endif
Object_handle o = pl->shoot(ray);
Object_handle o = pl->shoot(ray, vi);
#ifdef CGAL_NEF3_TIMER_POINT_LOCATION
timer_ray_shooting.stop();
#endif

View File

@ -80,7 +80,7 @@ public:
virtual Object_handle locate(const Point_3& p) const = 0;
virtual Object_handle shoot(const Ray_3& s, int mask=255) const = 0;
virtual Object_handle shoot(const Ray_3& s, Vertex_handle ray_source_vertex, int mask=255) const = 0;
virtual void intersect_with_edges( Halfedge_handle edge,
const Intersection_call_back& call_back)
@ -216,7 +216,7 @@ public:
delete candidate_provider;
}
virtual Object_handle shoot(const Ray_3& ray, int mask=255) const {
virtual Object_handle shoot(const Ray_3& ray, Vertex_handle ray_source_vertex, int mask=255) const {
CGAL_NEF_TIMER(rs_t.start());
CGAL_assertion( initialized);
_CGAL_NEF_TRACEN( "shooting: "<<ray);
@ -250,22 +250,25 @@ public:
else if( CGAL::assign( e, *o) && ((mask&2) != 0)) {
Point_3 q;
_CGAL_NEF_TRACEN("trying edge on "<< Segment_3(e->source()->point(),e->twin()->source()->point()));
if( is.does_intersect_internally( ray, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
_CGAL_NEF_TRACEN("ray intersects edge on "<<q);
_CGAL_NEF_TRACEN("prev. intersection? "<<hit);
CGAL_assertion_code
(if( hit) _CGAL_NEF_TRACEN("prev. intersection on "<<eor));
if( hit && !has_smaller_distance_to_point( ray.source(), q, eor))
continue;
_CGAL_NEF_TRACEN("is the intersection point on the current cell? "<<
candidate_provider->is_point_on_cell( q, objects_iterator));
if( !candidate_provider->is_point_on_cell( q, objects_iterator))
continue;
eor = q;
result = make_object(e);
hit = true;
_CGAL_NEF_TRACEN("the edge becomes the new hit object");
if ((ray_source_vertex != Vertex_handle()) && (ray_source_vertex != e->source()) && (ray_source_vertex != e->twin()->source())) {
if (is.does_intersect_internally(ray, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) {
_CGAL_NEF_TRACEN("ray intersects edge on " << q);
_CGAL_NEF_TRACEN("prev. intersection? " << hit);
CGAL_assertion_code
(if (hit) _CGAL_NEF_TRACEN("prev. intersection on " << eor));
if (hit && !has_smaller_distance_to_point(ray.source(), q, eor))
continue;
_CGAL_NEF_TRACEN("is the intersection point on the current cell? " <<
candidate_provider->is_point_on_cell(q, objects_iterator));
if (!candidate_provider->is_point_on_cell(q, objects_iterator))
continue;
eor = q;
result = make_object(e);
hit = true;
_CGAL_NEF_TRACEN("the edge becomes the new hit object");
}
}
}
else if( CGAL::assign( f, *o) && ((mask&4) != 0)) {
@ -661,7 +664,8 @@ public:
private:
Volume_handle determine_volume( const Ray_3& ray) const {
Halffacet_handle f_below;
Object_handle o = shoot(ray);
Vertex_handle null_vertex;
Object_handle o = shoot(ray, null_vertex);
Vertex_handle v;
Halfedge_handle e;
Halffacet_handle f;