fix warning + cosmetic changes

This commit is contained in:
Sébastien Loriot 2018-11-02 14:17:16 +01:00
parent aee51d4b42
commit 057f4eafe7
34 changed files with 300 additions and 324 deletions

View File

@ -32,7 +32,8 @@ namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_2& a,
const Point_2<K>& b) {
const Point_2<K>& b)
{
Point_2<K> bl(a.xmin(), a.ymin()), tr(a.xmax(), a.ymax());
Iso_rectangle_2<K> ic(bl,tr);
@ -42,7 +43,8 @@ bool do_intersect(const CGAL::Bbox_2& a,
template<typename K>
bool do_intersect(const Point_2<K>& a,
const CGAL::Bbox_2& b) {
const CGAL::Bbox_2& b)
{
return do_intersect(b,a);
}
@ -53,11 +55,10 @@ namespace internal {
template<typename K>
typename CGAL::Intersection_traits<K, typename K::Point_2, CGAL::Bbox_2>::result_type
intersection(const Point_2<K>& a,
const CGAL::Bbox_2& b
) {
if (do_intersect(a,b)) {
const CGAL::Bbox_2& b)
{
if (do_intersect(a,b))
return Intersections::internal::intersection_return<typename K::Intersect_2, typename K::Point_2, CGAL::Bbox_2>(a);
}
return Intersections::internal::intersection_return<typename K::Intersect_2, typename K::Point_2, CGAL::Bbox_2>();
}
@ -66,10 +67,10 @@ template<typename K>
typename CGAL::Intersection_traits<K, CGAL::Bbox_2, typename K::Point_2>::result_type
intersection(const CGAL::Bbox_2& b,
const typename K::Point_2 & a,
const K& k ) {
if (do_intersect(a,b)) {
const K& /*k*/ )
{
if (do_intersect(a,b))
return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>(a);
}
return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>();
}
@ -83,7 +84,8 @@ intersection(const Bbox_2& b,
{
return Intersections::internal::intersection(b,a,K());
}
template<typename K>
template<typename K>
typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type
intersection(const Point_2<K> & a,
const Bbox_2& b)

View File

@ -28,11 +28,8 @@
#include <CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h>
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_rectangle_2, Circle_2, 2)
}
#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_CIRCLE_2_H

View File

@ -61,9 +61,8 @@ intersection(const typename K::Point_2 &pt,
const typename K::Circle_2 &circle,
const K& k)
{
if (do_intersect(pt,circle, k)) {
if (do_intersect(pt,circle, k))
return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>(pt);
}
return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>();
}

View File

@ -35,11 +35,11 @@ namespace Intersections {
namespace internal {
template <class K, class Box3>
bool do_intersect_circle_box_2(const typename K::Circle_2& circle,
template <class K, class Box3>
bool do_intersect_circle_box_2(const typename K::Circle_2& circle,
const Box3& bbox,
const K&)
{
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point;
FT d = FT(0);
@ -69,41 +69,41 @@ namespace internal {
}
return distance <= circle.squared_radius();
}
}
template <class K>
bool do_intersect(const CGAL::Bbox_2& bbox,
template <class K>
bool do_intersect(const CGAL::Bbox_2& bbox,
const typename K::Circle_2& circle,
const K&)
{
{
return do_intersect_circle_box_2(circle, bbox, K());
}
}
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
const CGAL::Bbox_2& bbox,
const K&)
{
{
return do_intersect_circle_box_2(circle, bbox, K());
}
}
template <class K>
bool do_intersect(const typename K::Iso_rectangle_2& bbox,
template <class K>
bool do_intersect(const typename K::Iso_rectangle_2& bbox,
const typename K::Circle_2& circle,
const K&)
{
{
return do_intersect_circle_box_2(circle, bbox, K());
}
}
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
const typename K::Iso_rectangle_2& bbox,
const K&)
{
{
return do_intersect_circle_box_2(circle, bbox, K());
}
}
} // namespace internal
} // namespace Intersections

View File

@ -27,13 +27,13 @@
#include <CGAL/Bbox_3.h>
namespace CGAL {
bool
inline
do_intersect(const CGAL::Bbox_3& c,
bool
inline
do_intersect(const CGAL::Bbox_3& c,
const CGAL::Bbox_3& bbox)
{
{
return CGAL::do_overlap(c, bbox);
}
}
} //namespace CGAL

View File

@ -51,11 +51,10 @@ bool do_intersect(const Point_3<K>& a,
template<typename K>
typename Intersection_traits<K, typename K::Point_3, CGAL::Bbox_3>::result_type
intersection(const Point_3<K>& a,
const CGAL::Bbox_3& b
) {
if (do_intersect(a,b)) {
const CGAL::Bbox_3& b)
{
if (do_intersect(a,b))
return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>(a);
}
return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>();
}
@ -63,10 +62,10 @@ intersection(const Point_3<K>& a,
template<typename K>
typename Intersection_traits<K, CGAL::Bbox_3, typename K::Point_3>::result_type
intersection(const CGAL::Bbox_3& b,
const Point_3<K>& a) {
if (do_intersect(a,b)) {
const Point_3<K>& a)
{
if (do_intersect(a,b))
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>(a);
}
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>();
}

View File

@ -57,9 +57,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Iso_cuboid_3 &iso,
const K& k)
{
if (internal::do_intersect(pt,iso,k)) {
if (internal::do_intersect(pt,iso,k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Iso_cuboid_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Iso_cuboid_3>();
}

View File

@ -28,11 +28,8 @@
#include <CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h>
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Sphere_3, 3)
}
#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H

View File

@ -30,7 +30,6 @@
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Tetrahedron_3, 3)
}
#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TETRAHEDRON_3_H

View File

@ -57,9 +57,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Line_3 &line,
const K& k)
{
if (do_intersect(pt,line,k)) {
if (do_intersect(pt,line,k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Line_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Line_3>();
}

View File

@ -57,9 +57,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Plane_3 &plane,
const K& k)
{
if (do_intersect(pt,plane,k)) {
if (do_intersect(pt,plane,k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Plane_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Plane_3>();
}

View File

@ -47,9 +47,8 @@ intersection(const typename K::Point_3 &pt1,
const typename K::Point_3 &pt2,
const K&)
{
if (pt1 == pt2) {
if (pt1 == pt2)
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Point_3>(pt1);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Point_3>();
}

View File

@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Segment_3 &seg,
const K& k)
{
if (do_intersect(pt,seg, k)) {
if (do_intersect(pt,seg, k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Segment_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Segment_3>();
}

View File

@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Sphere_3 &sphere,
const K& k)
{
if (do_intersect(pt,sphere, k)) {
if (do_intersect(pt,sphere, k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Sphere_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Sphere_3>();
}

View File

@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Tetrahedron_3 &tetrahedron,
const K& k)
{
if (do_intersect(pt,tetrahedron, k)) {
if (do_intersect(pt,tetrahedron, k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>();
}

View File

@ -30,7 +30,6 @@
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Segment_3, Tetrahedron_3, 3)
}
#endif // CGAL_INTERSECTIONS_3_SEGMENT_3_TETRAHEDRON_3_H

View File

@ -30,7 +30,6 @@
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Tetrahedron_3, 3)
}
#endif // CGAL_INTERSECTIONS_3_SPHERE_3_TETRAHEDRON_3_H

View File

@ -30,7 +30,6 @@
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Triangle_3, 3)
}
#endif // CGAL_INTERSECTIONS_3_SPHERE_3_TRIANGLE_3_H

View File

@ -32,11 +32,11 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const CGAL::Bbox_3& bb,
template <class K>
bool do_intersect(const CGAL::Bbox_3& bb,
const typename K::Iso_cuboid_3& ic,
const K& k)
{
const K& /* k */)
{
if (bb.xmax() < ic.xmin() || ic.xmax() < bb.xmin())
return false;
if (bb.ymax() < ic.ymin() || ic.ymax() < bb.ymin())
@ -44,7 +44,7 @@ namespace internal {
if (bb.zmax() < ic.zmin() || ic.zmax() < bb.zmin())
return false;
return true;
}
}
} // namespace internal
} // namespace Intersections

View File

@ -37,11 +37,11 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Ray_3& ray,
template <class K>
bool do_intersect(const typename K::Ray_3& ray,
const typename K::Iso_cuboid_3& ic,
const K&)
{
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
@ -59,14 +59,14 @@ namespace internal {
(ic.min)().x(), (ic.min)().y(), (ic.min)().z(),
(ic.max)().x(), (ic.max)().y(), (ic.max)().z()
);
}
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Ray_3& ray,
const K&) {
return do_intersect(ray, ic, K());
}
}
} // namespace internal
} // namespace Intersections

View File

@ -37,11 +37,11 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Segment_3& seg,
template <class K>
bool do_intersect(const typename K::Segment_3& seg,
const typename K::Iso_cuboid_3& ic,
const K&)
{
{
typedef typename K::FT FT;
typedef typename K::Point_3 Point_3;
@ -59,14 +59,14 @@ namespace internal {
(ic.min)().x(), (ic.min)().y(), (ic.min)().z(),
(ic.max)().x(), (ic.max)().y(), (ic.max)().z()
);
}
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Segment_3& seg,
const K&) {
return do_intersect(seg, ic, K());
}
}
} // namespace internal
} // namespace Intersections

View File

@ -33,21 +33,21 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Sphere_3& sphere,
const K&)
{
{
return do_intersect_sphere_box_3(sphere, ic, K());
}
}
template <class K>
bool do_intersect(const typename K::Sphere_3& sphere,
template <class K>
bool do_intersect(const typename K::Sphere_3& sphere,
const typename K::Iso_cuboid_3& ic,
const K&)
{
{
return do_intersect_sphere_box_3(sphere, ic, K());
}
}
} // namespace internal
} // namespace Intersections
@ -64,7 +64,6 @@ bool do_intersect(const Sphere_3<K>& a,
return K().do_intersect_3_object()(a, b);
}
} //namespace CGAL
#endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_DO_INTERSECT_H

View File

@ -39,21 +39,21 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Triangle_3& triangle,
template <class K>
bool do_intersect(const typename K::Triangle_3& triangle,
const typename K::Iso_cuboid_3& bbox,
const K& k)
{
{
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
}
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox,
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox,
const typename K::Triangle_3& triangle,
const K& k)
{
{
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
}
}
} // namespace internal
} // namespace Intersections

View File

@ -33,8 +33,8 @@
namespace CGAL {
template <class K>
class Tetrahedron_3;
template <class K>
class Tetrahedron_3;
namespace Intersections {
@ -110,7 +110,6 @@ do_intersect(const typename K::Segment_3 &seg,
return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k);
}
template <class K>
inline
typename K::Boolean
@ -131,7 +130,6 @@ do_intersect(const typename K::Iso_cuboid_3 &ic,
return do_intersect_tetrahedron_bounded(ic, tet, ic[0], k);
}
template <class K>
inline
typename K::Boolean
@ -152,7 +150,6 @@ do_intersect(const typename K::Sphere_3 &sp,
return do_intersect_tetrahedron_bounded(sp, tet, sp.center(), k);
}
template <class K>
inline
typename K::Boolean

View File

@ -27,14 +27,14 @@
namespace CGAL {
template <class K>
class Triangle_3;
template <class K>
class Triangle_3;
template <class K>
class Sphere_3;
template <class K>
class Sphere_3;
template <class K>
class Line_3;
template <class K>
class Line_3;
namespace Intersections {
@ -45,7 +45,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Triangle_3 &tr,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), tr) <= sp.squared_radius();
}
@ -55,7 +55,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Triangle_3 &tr,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), tr) <= sp.squared_radius();
}
@ -64,7 +64,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Line_3 &lin,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -75,7 +75,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Line_3 &lin,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -87,7 +87,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Ray_3 &lin,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -98,7 +98,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Ray_3 &lin,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -108,7 +108,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Segment_3 &lin,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -119,7 +119,7 @@ inline
typename K::Boolean
do_intersect(const typename K::Segment_3 &lin,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -129,4 +129,3 @@ do_intersect(const typename K::Segment_3 &lin,
} // namespace CGAL
#endif // CGAL_TRIANGLE_3_SPHERE_3_DO_INTERSECT_H

View File

@ -36,7 +36,6 @@ int main()
CGAL::do_intersect(sp, Ray());
CGAL::do_intersect(sp, Segment());
CGAL::do_intersect(Triangle(), tet);
CGAL::do_intersect(Segment(), tet);
CGAL::do_intersect(Iso_cuboid(), tet);
@ -52,5 +51,4 @@ int main()
return 0;
}