Merge remote-tracking branch 'afabri/Nef_3-avoid_needless_tests-GF' into Nef_3-cleanup_snc_intersection-GilesBathgate

This commit is contained in:
Giles Bathgate 2022-03-20 10:35:12 +00:00
commit 3b8a9dc9c1
9 changed files with 44 additions and 18 deletions

View File

@ -60,6 +60,9 @@ public:
PlaneC3(const Point_3 &p, const Vector_3 &v)
{ *this = plane_from_point_direction<R>(p, v.direction()); }
PlaneC3(Origin o, const Vector_3 &v)
{ *this = plane_from_point_direction<R>(o, v.direction()); }
PlaneC3(const FT &a, const FT &b, const FT &c, const FT &d)
: base(CGAL::make_array(a, b, c, d)) {}

View File

@ -53,6 +53,15 @@ plane_from_point_direction(const typename R::Point_3 &p,
return PlaneC3<R>(A, B, C, D);
}
template <class R>
CGAL_KERNEL_LARGE_INLINE
PlaneC3<R>
plane_from_point_direction(Origin o,
const typename R::Direction_3 &d)
{
return PlaneC3<R>(d.dx(), d.dy(), d.dz(), 0);
}
} //namespace CGAL
#endif // CGAL_CARTESIAN_PLANE_CONSTRUCTIONS_3_H

View File

@ -58,6 +58,7 @@ public:
PlaneH3(const Ray_3&, const Point_3& );
PlaneH3(const Point_3&, const Direction_3& );
PlaneH3(const Point_3&, const Vector_3& );
PlaneH3(Origin, const Vector_3& );
PlaneH3(const Point_3&, const Direction_3&, const Direction_3& );
const RT & a() const;
@ -239,6 +240,17 @@ PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,
-(ov.hx()*p.hx() + ov.hy()*p.hy() + ov.hz()*p.hz() ) );
}
template < class R >
CGAL_KERNEL_INLINE
PlaneH3<R>::PlaneH3(Origin,
const typename PlaneH3<R>::Vector_3& ov)
{
new_rep( ov.hx(),
ov.hy(),
ov.hz(),
RT(0) );
}
template < class R >
CGAL_KERNEL_INLINE
PlaneH3<R>::PlaneH3(const typename PlaneH3<R>::Point_3& p,

View File

@ -2046,6 +2046,10 @@ namespace CommonKernelFunctors {
operator()(Return_base_tag, const Point_3& p, const Vector_3& v) const
{ return Rep(p, v); }
Rep // Plane_3
operator()(Return_base_tag, Origin o, const Vector_3& v) const
{ return Rep(o, v); }
Rep // Plane_3
operator()(Return_base_tag, const Line_3& l, const Point_3& p) const
{ return Rep(l, p); }

View File

@ -78,6 +78,9 @@ public:
Plane_3(const Point_3& p, const Vector_3& v)
: Rep(typename R::Construct_plane_3()(Return_base_tag(), p, v)) {}
Plane_3(Origin o, const Vector_3& v)
: Rep(typename R::Construct_plane_3()(Return_base_tag(), o, v)) {}
Plane_3(const RT& a, const RT& b, const RT& c, const RT& d)
: Rep(typename R::Construct_plane_3()(Return_base_tag(), a, b, c, d)) {}

View File

@ -72,12 +72,8 @@ class SNC_intersection : public SNC_const_decorator<SNC_structure_> {
SNC_intersection() : Base() {}
SNC_intersection(const SNC_structure& W) : Base(W) {}
bool does_contain_internally(const Segment_3& s, const Point_3& p) const {
if(!are_strictly_ordered_along_line (s.source(), p, s.target()))
return false;
if(!s.supporting_line().has_on(p))
return false;
return true;
bool does_contain_internally(const Point_3& s, const Point_3& t, const Point_3& p) const {
return are_strictly_ordered_along_line (s, p, t);
}
bool does_contain_internally( Halffacet_const_handle f,

View File

@ -319,7 +319,7 @@ public:
}
}
else if( CGAL::assign( e, *o)) {
if ( is.does_contain_internally(Segment_3(e->source()->point(),e->twin()->source()->point()), p) ) {
if ( is.does_contain_internally(e->source()->point(), e->twin()->source()->point(), p) ) {
_CGAL_NEF_TRACEN("found on edge "<<Segment_3(e->source()->point(),e->twin()->source()->point()));
result = make_object(e);
found = true;
@ -417,7 +417,7 @@ public:
// (e->source() == v || e->twin()->source() == v)) continue;
Segment_3 ss(e->source()->point(),e->twin()->source()->point());
CGAL_NEF_TRACEN("test edge " << e->source()->point() << "->" << e->twin()->source()->point());
if (is.does_contain_internally(ss, p)) {
if (is.does_contain_internally(e->source()->point(), e->twin()->source()->point(), p)) {
_CGAL_NEF_TRACEN("found on edge "<< ss);
return make_object(e);
}
@ -484,8 +484,7 @@ public:
//CGAL_warning("altered code in SNC_point_locator");
SM_point_locator L(&*v);
// Object_handle so = L.locate(s.source()-s.target(), true);
Object_handle so = L.locate(s.source()-s.target());
Object_handle so = L.locate(s.source()-s.target(), true);
SFace_handle sf;
if(CGAL::assign(sf,so))
return make_object(sf->volume());

View File

@ -504,25 +504,25 @@ private:
Point_3 p;
assert(!is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(0,0,0)));
assert(!is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(2,0,0)));
assert(!is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(3,0,0)));
assert(!is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(-1,0,0)));
assert(!is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(1,1,0)));
assert(!is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(7,25,11)));
assert(is.does_contain_internally(
Segment_3(Point_3(0,0,0), Point_3(2,0,0)),
Point_3(0,0,0), Point_3(2,0,0),
Point_3(1,0,0)));
assert(!is.does_intersect_internally(

View File

@ -43,7 +43,7 @@ Sphere_segment_rep(const Point& p1, const Point& p2,
CGAL_warning(p1 != p2.antipode());
CGAL_assertion(p1 != p2.antipode());
if ( p1 == p2 ) {
Plane_3 h(Point_3(CGAL::ORIGIN),(p1-CGAL::ORIGIN));
Plane_3 h(CGAL::ORIGIN, (p1-CGAL::ORIGIN));
c_ = Sphere_circle<R_>(Plane_3(Point_3(CGAL::ORIGIN),h.base1()));
}
if (!shorter_arc) c_ = c_.opposite();