more indentation fixes

This commit is contained in:
Maxime Gimeno 2019-10-23 09:56:56 +02:00
parent 9a8f26ced7
commit 2bfa95a2ed
2 changed files with 48 additions and 43 deletions

View File

@ -28,9 +28,7 @@
#include <vector> #include <vector>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template<typename Segment> template<typename Segment>
@ -41,19 +39,19 @@ void filter_segments(const std::vector<Segment>& input,
do do
{ {
Segment s = tmp.back(); Segment s = tmp.back();
tmp.pop_back(); tmp.pop_back();
for(auto s_it = tmp.begin(); s_it != tmp.end();) for(auto s_it = tmp.begin(); s_it != tmp.end();)
{
if(s == *s_it || s == s_it->opposite())
{ {
s_it = tmp.erase(s_it); if(s == *s_it || s == s_it->opposite())
{
s_it = tmp.erase(s_it);
}
else {
++s_it;
}
} }
else { output.push_back(s);
++s_it;
}
}
output.push_back(s);
}while (!tmp.empty()); }while (!tmp.empty());
} }
@ -215,16 +213,15 @@ void fill_points_list(std::list<Segment>& segments, std::list<Point>& points)
{ {
CGAL_assertion(segments.size() > 1); CGAL_assertion(segments.size() > 1);
//init : take seg.front = seg.
Segment seg = segments.front(); Segment seg = segments.front();
segments.pop_front(); segments.pop_front();
//put source and target in points.
points.push_back(seg.source()); points.push_back(seg.source());
points.push_back(seg.target()); points.push_back(seg.target());
//find first seg with a point in common with seg.front = s2. //find first seg with a point in common with seg.front = s2.
do{ do
{
auto seg_it = segments.begin(); auto seg_it = segments.begin();
bool found = false; bool found = false;
for(;seg_it != segments.end(); ++seg_it) for(;seg_it != segments.end(); ++seg_it)
@ -266,5 +263,7 @@ void fill_points_list(std::list<Segment>& segments, std::list<Point>& points)
}while(!segments.empty()); }while(!segments.empty());
} }
}}}//end namespaces }
}
}//end namespaces
#endif // CGAL_INTERNAL_TETRAHEDRON_INTERSECTION_HELPERS_H #endif // CGAL_INTERNAL_TETRAHEDRON_INTERSECTION_HELPERS_H

View File

@ -28,28 +28,29 @@
#include <CGAL/intersections.h> #include <CGAL/intersections.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template<class K, class O, class T>
template<class K, class O, class Derived>
struct Tetrahedron_lines_intersection_3_base struct Tetrahedron_lines_intersection_3_base
{ {
typedef typename Intersection_traits<K, typedef typename Intersection_traits<K,
CGAL::Tetrahedron_3<K>, CGAL::Tetrahedron_3<K>,
O>::result_type Result_type; O>::result_type Result_type;
typedef typename Intersection_traits<K, typedef typename Intersection_traits<K,
CGAL::Triangle_3<K>, CGAL::Triangle_3<K>,
O>::result_type Inter_type; O>::result_type Inter_type;
Tetrahedron_lines_intersection_3_base(const typename K::Tetrahedron_3& tet,
const O& o):tet(tet), o(o)
{}
const typename K::Tetrahedron_3& tet; const typename K::Tetrahedron_3& tet;
const O& o; const O& o;
std::vector<typename K::Point_3> res_points; std::vector<typename K::Point_3> res_points;
Result_type output; Result_type output;
Tetrahedron_lines_intersection_3_base(const typename K::Tetrahedron_3& tet,
const O& o):tet(tet), o(o)
{}
bool all_inside_test() bool all_inside_test()
{ {
return false; return false;
@ -62,7 +63,7 @@ struct Tetrahedron_lines_intersection_3_base
void do_procede() void do_procede()
{ {
if(static_cast<T*>(this)->all_inside_test()) if(static_cast<Derived*>(this)->all_inside_test())
return; return;
int res_id = -1; int res_id = -1;
@ -70,18 +71,18 @@ struct Tetrahedron_lines_intersection_3_base
Inter_type tr_seg[4]; Inter_type tr_seg[4];
for(std::size_t i = 0; i < 4; ++i) for(std::size_t i = 0; i < 4; ++i)
{ {
const typename K::Triangle_3 triangle(tet.vertex((i+1)%4), const typename K::Triangle_3 triangle(tet.vertex((i+1)%4),
tet.vertex((i+2)%4), tet.vertex((i+2)%4),
tet.vertex((i+3)%4)); tet.vertex((i+3)%4));
if(do_intersect(o, triangle)) if(do_intersect(o, triangle))
{ {
tr_seg[i] = typename K::Intersect_3()(o, triangle); tr_seg[i] = typename K::Intersect_3()(o, triangle);
if( boost::get<typename K::Segment_3>(&*tr_seg[i]) != nullptr) if( boost::get<typename K::Segment_3>(&*tr_seg[i]) != nullptr)
{ {
res_id = i; res_id = i;
break; break;
} }
} }
} }
//if there is a segment in the intersections, then we return it //if there is a segment in the intersections, then we return it
@ -94,6 +95,7 @@ struct Tetrahedron_lines_intersection_3_base
//else if there is only 1 intersection //else if there is only 1 intersection
res_points.reserve(4); res_points.reserve(4);
res_id = -1; res_id = -1;
for(std::size_t i = 0; i< 4; ++i) for(std::size_t i = 0; i< 4; ++i)
{ {
if(tr_seg[i]) if(tr_seg[i])
@ -114,22 +116,26 @@ struct Tetrahedron_lines_intersection_3_base
} }
} }
} }
if(res_points.empty()) if(res_points.empty())
{ {
return; return;
} }
if(res_id != -1) if(res_id != -1)
{ {
if(static_cast<T*>(this)->are_extremities_inside_test()) if(static_cast<Derived*>(this)->are_extremities_inside_test())
return; return;
//else point and segment entirely not inside or one intersection on boundary: //else point and segment entirely not inside or one intersection on boundary:
output = tr_seg[res_id]; output = tr_seg[res_id];
return; return;
} }
//else, we return a segment of the 2 intersection points (the most far away, in case of inexact) //else, we return a segment of the 2 intersection points (the most far away, in case of inexact)
typename K::FT max_dist = 0; typename K::FT max_dist = 0;
std::size_t res_id_2 = -1; std::size_t res_id_2 = -1;
std::vector<std::vector<typename K::FT> > sq_distances(res_points.size()); std::vector<std::vector<typename K::FT> > sq_distances(res_points.size());
for(std::size_t i = 0; i< res_points.size(); ++i) for(std::size_t i = 0; i< res_points.size(); ++i)
{ {
auto p1 = res_points[i]; auto p1 = res_points[i];
@ -144,12 +150,12 @@ struct Tetrahedron_lines_intersection_3_base
} }
} }
} }
CGAL_assertion(res_id != -1); CGAL_assertion(res_id != -1);
CGAL_assertion(res_id_2 != -1); CGAL_assertion(res_id_2 != -1);
CGAL_assertion(max_dist >0 ); CGAL_assertion(max_dist >0 );
typename K::Segment_3 res_seg(res_points[res_id], res_points[res_id_2]); typename K::Segment_3 res_seg(res_points[res_id], res_points[res_id_2]);
output = Result_type(std::forward<typename K::Segment_3>(res_seg)); output = Result_type(std::forward<typename K::Segment_3>(res_seg));
return; return;
} }
@ -157,5 +163,5 @@ struct Tetrahedron_lines_intersection_3_base
} }
} }
} } //end namespaces
#endif // CGAL_INTERNAL_INTERSECTIONS_3_TETRAHEDRON_LINES_INTERSECTIONS_3_H #endif // CGAL_INTERNAL_INTERSECTIONS_3_TETRAHEDRON_LINES_INTERSECTIONS_3_H