Some changes after Sebastien's review

This commit is contained in:
Andreas Fabri 2018-11-29 15:58:34 +01:00
parent a76623e7e8
commit aac8ac4e6b
5 changed files with 32 additions and 12 deletions

View File

@ -46,25 +46,25 @@ bool do_intersect_circle_box_2(const typename K::Circle_2& circle,
FT distance = FT(0);
Point center = circle.center();
if(center.x() < (FT)bbox.xmin())
if(center.x() < FT(bbox.xmin()))
{
d = (FT)bbox.xmin() - center.x();
d = FT(bbox.xmin()) - center.x();
distance += d * d;
}
else if(center.x() > (FT)bbox.xmax())
else if(center.x() > FT(bbox.xmax()))
{
d = center.x() - (FT)bbox.xmax();
d = center.x() - FT(bbox.xmax());
distance += d * d;
}
if(center.y() < (FT)bbox.ymin())
if(center.y() < FT(bbox.ymin()))
{
d = (FT)bbox.ymin() - center.y();
d = FT(bbox.ymin()) - center.y();
distance += d * d;
}
else if(center.y() > (FT)bbox.ymax())
else if(center.y() > FT(bbox.ymax()))
{
d = center.y() - (FT)bbox.ymax();
d = center.y() - FT(bbox.ymax());
distance += d * d;
}

View File

@ -50,7 +50,7 @@ do_intersect(const typename K::Tetrahedron_3 &tetrahedron,
const typename K::Point_3 &pt,
const K&)
{
return tetrahedron.has_on_unbounded_side(pt);
return ! tetrahedron.has_on_unbounded_side(pt);
}

View File

@ -51,7 +51,7 @@ do_intersect(const typename K::Tetrahedron_3 &tet,
typename K::Boolean
do_intersect_tetrahedron_bounded(const Bounded &tr,
const typename K::Tetrahedron_3 &tet,
const typename K::Point_3 p,
const typename K::Point_3 &p,
const K & k)
{
typedef typename K::Triangle_3 Triangle;

View File

@ -21,7 +21,6 @@ if ( CGAL_FOUND )
foreach(cppfile ${cppfiles})
create_single_source_cgal_program( "${cppfile}" )
endforeach()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")

View File

@ -89,6 +89,25 @@ void test_P_Pl()
assert(res == p);
}
template<typename K>
void test_P_Tet()
{
typedef CGAL::Point_3<K> P;
typedef CGAL::Tetrahedron_3<K> T;
P p(0,0,0), q(1,0,0), r(1,1,0), s(0,0,1);
T t(p,q,r,s);
P q0(0.1, 0.1, 0.1), q1(10,10,10);
assert(CGAL::do_intersect(p,t));
assert(CGAL::do_intersect(t,p));
assert(CGAL::do_intersect(q0,t));
assert(CGAL::do_intersect(t,q0));
assert(! CGAL::do_intersect(q1,t));
assert(! CGAL::do_intersect(t,q1));
}
int main()
{
test_P_Cub<Epick>();
@ -99,7 +118,6 @@ int main()
test_P_R<Epick>();
test_P_R<Epeck>();
test_P_S<Epick>();
test_P_S<Epeck>();
@ -108,6 +126,9 @@ int main()
test_P_Pl<Epick>();
test_P_Pl<Epeck>();
test_P_Tet<Epick>();
test_P_Tet<Epeck>();
}
#include <iostream>