Skip to content

Commit c6ad31c

Browse files
committed
Implement shape union
1 parent ee99f40 commit c6ad31c

File tree

3 files changed

+178
-380
lines changed

3 files changed

+178
-380
lines changed

src/irregular/shape_self_intersections_removal.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,22 @@ std::pair<Shape, std::vector<Shape>> packingsolver::irregular::remove_self_inter
332332
return {new_shape, new_holes};
333333
}
334334

335+
std::pair<Shape, std::vector<Shape>> irregular::compute_union(
336+
const Shape& shape_1,
337+
const Shape& shape_2)
338+
{
339+
Shape shape_tmp;
340+
shape_tmp.elements.insert(
341+
shape_tmp.elements.end(),
342+
shape_1.elements.begin(),
343+
shape_1.elements.end());
344+
shape_tmp.elements.insert(
345+
shape_tmp.elements.end(),
346+
shape_2.elements.begin(),
347+
shape_2.elements.end());
348+
return remove_self_intersections(shape_tmp);
349+
}
350+
335351
std::vector<Shape> irregular::extract_all_holes_from_self_intersecting_hole(
336352
const Shape& shape)
337353
{

src/irregular/shape_self_intersections_removal.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ namespace irregular
1010
std::pair<Shape, std::vector<Shape>> remove_self_intersections(
1111
const Shape& shape);
1212

13+
std::pair<Shape, std::vector<Shape>> compute_union(
14+
const Shape& shape_1,
15+
const Shape& shape_2);
16+
1317
std::vector<Shape> extract_all_holes_from_self_intersecting_hole(
1418
const Shape& shape);
1519

0 commit comments

Comments
 (0)