This commit is contained in:
Maxime Gimeno 2019-06-17 15:24:43 +02:00
parent 3e5d3acb2f
commit e58b4475e7
3 changed files with 9 additions and 14 deletions

View File

@ -37,7 +37,7 @@ namespace internal {
template<typename Point> template<typename Point>
void filter_points(const std::vector<Point>& input, void filter_points(const std::vector<Point>& input,
std::vector<Point>& output) std::vector<Point>& output)
{ {
std::set<Point> tmp; std::set<Point> tmp;
for( auto p : input) for( auto p : input)
@ -60,12 +60,10 @@ intersection(
typedef typename K::Plane_3 Plane_3; typedef typename K::Plane_3 Plane_3;
typedef std::vector<Point_3> Poly; typedef std::vector<Point_3> Poly;
typedef typename Intersection_traits<K, typedef typename Intersection_traits<K, CGAL::Iso_cuboid_3<K>,
CGAL::Iso_cuboid_3<K>,
CGAL::Plane_3<K> >::result_type Result_type; CGAL::Plane_3<K> >::result_type Result_type;
typedef typename Intersection_traits<K, typedef typename Intersection_traits<K, CGAL::Segment_3<K>,
CGAL::Segment_3<K>,
CGAL::Plane_3<K> >::result_type Inter_type; CGAL::Plane_3<K> >::result_type Inter_type;
std::vector<Segment_3> edges; std::vector<Segment_3> edges;

View File

@ -60,9 +60,9 @@ intersection(
std::vector<Segment_3> segments; std::vector<Segment_3> segments;
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));
intersections[i] = typename K::Intersect_3()(pl, triangle); intersections[i] = typename K::Intersect_3()(pl, triangle);
if(intersections[i]){ if(intersections[i]){
if(const typename K::Triangle_3* tr = boost::get<typename K::Triangle_3>(&*intersections[i])) if(const typename K::Triangle_3* tr = boost::get<typename K::Triangle_3>(&*intersections[i]))
@ -95,7 +95,7 @@ intersection(
else else
{ {
typename K::Point_3 p typename K::Point_3 p
= *boost::get<typename K::Point_3>(&*intersections[p_id]); = *boost::get<typename K::Point_3>(&*intersections[p_id]);
return Result_type(std::forward<typename K::Point_3>(p)); return Result_type(std::forward<typename K::Point_3>(p));
} }
@ -125,9 +125,7 @@ intersection(
} }
else //size = 4 else //size = 4
{ {
std::list<Segment_3> segs; std::list<Segment_3> segs(segments.begin(), segments.end());
for(auto s : segments)
segs.push_back(s);
std::list<typename K::Point_3> tmp; std::list<typename K::Point_3> tmp;
fill_points_list(segs, tmp); fill_points_list(segs, tmp);
std::vector<typename K::Point_3> res; std::vector<typename K::Point_3> res;

View File

@ -43,8 +43,7 @@ void filter_segments(const std::vector<Segment>& input,
{ {
Segment s = tmp.back(); Segment s = tmp.back();
tmp.pop_back(); tmp.pop_back();
auto s_it = tmp.begin(); for(auto s_it = tmp.begin(); s_it != tmp.end();)
for(; s_it != tmp.end();)
{ {
if(s == *s_it || s == s_it->opposite()) if(s == *s_it || s == s_it->opposite())
{ {