forked from jbuckmccready/CavalierContours
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpolylinecombine.cpp
29 lines (24 loc) · 973 Bytes
/
polylinecombine.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "cavc/polylinecombine.hpp"
using namespace cavc;
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
// closed polyline representing a circle
Polyline<double> circle;
circle.addVertex(0, 1, 1);
circle.addVertex(10, 1, 1);
circle.isClosed() = true;
// closed polyline representing a rectangle (overlaps with the circle)
Polyline<double> rectangle;
rectangle.addVertex(3, -10, 0);
rectangle.addVertex(6, -10, 0);
rectangle.addVertex(6, 10, 0);
rectangle.addVertex(3, 10, 0);
rectangle.isClosed() = true;
CombineResult<double> unionResult = combinePolylines(circle, rectangle, PlineCombineMode::Union);
CombineResult<double> excludeResult =
combinePolylines(circle, rectangle, PlineCombineMode::Exclude);
CombineResult<double> intersectResult =
combinePolylines(circle, rectangle, PlineCombineMode::Intersect);
CombineResult<double> xorResult = combinePolylines(circle, rectangle, PlineCombineMode::XOR);
}