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++; number_of_ray_shooting_queries++;
timer_ray_shooting.start(); timer_ray_shooting.start();
#endif #endif
Object_handle o = pl->shoot(ray); Object_handle o = pl->shoot(ray, vi);
#ifdef CGAL_NEF3_TIMER_POINT_LOCATION #ifdef CGAL_NEF3_TIMER_POINT_LOCATION
timer_ray_shooting.stop(); timer_ray_shooting.stop();
#endif #endif

View File

@ -80,7 +80,7 @@ public:
virtual Object_handle locate(const Point_3& p) const = 0; 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, virtual void intersect_with_edges( Halfedge_handle edge,
const Intersection_call_back& call_back) const Intersection_call_back& call_back)
@ -216,7 +216,7 @@ public:
delete candidate_provider; 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_NEF_TIMER(rs_t.start());
CGAL_assertion( initialized); CGAL_assertion( initialized);
_CGAL_NEF_TRACEN( "shooting: "<<ray); _CGAL_NEF_TRACEN( "shooting: "<<ray);
@ -250,6 +250,8 @@ public:
else if( CGAL::assign( e, *o) && ((mask&2) != 0)) { else if( CGAL::assign( e, *o) && ((mask&2) != 0)) {
Point_3 q; Point_3 q;
_CGAL_NEF_TRACEN("trying edge on "<< Segment_3(e->source()->point(),e->twin()->source()->point())); _CGAL_NEF_TRACEN("trying edge on "<< Segment_3(e->source()->point(),e->twin()->source()->point()));
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(), if (is.does_intersect_internally(ray, Segment_3(e->source()->point(),
e->twin()->source()->point()), q)) { e->twin()->source()->point()), q)) {
_CGAL_NEF_TRACEN("ray intersects edge on " << q); _CGAL_NEF_TRACEN("ray intersects edge on " << q);
@ -268,6 +270,7 @@ public:
_CGAL_NEF_TRACEN("the edge becomes the new hit object"); _CGAL_NEF_TRACEN("the edge becomes the new hit object");
} }
} }
}
else if( CGAL::assign( f, *o) && ((mask&4) != 0)) { else if( CGAL::assign( f, *o) && ((mask&4) != 0)) {
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()<<
@ -661,7 +664,8 @@ public:
private: private:
Volume_handle determine_volume( const Ray_3& ray) const { Volume_handle determine_volume( const Ray_3& ray) const {
Halffacet_handle f_below; Halffacet_handle f_below;
Object_handle o = shoot(ray); Vertex_handle null_vertex;
Object_handle o = shoot(ray, null_vertex);
Vertex_handle v; Vertex_handle v;
Halfedge_handle e; Halfedge_handle e;
Halffacet_handle f; Halffacet_handle f;