-
Notifications
You must be signed in to change notification settings - Fork 0
/
walnut_union.cxx
39 lines (31 loc) · 973 Bytes
/
walnut_union.cxx
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
30
31
32
33
34
35
36
37
38
39
#include "render.h"
#include <vtkCubeSource.h>
#include <vtkCylinderSource.h>
#include "walnut/vtkWalnutBooleanFilter.h"
vtkSmartPointer<vtkPolyDataAlgorithm> GenerateShape() {
auto cu = vtkSmartPointer<vtkCubeSource>::New();
cu->SetXLength(10);
cu->SetYLength(5);
cu->SetZLength(10);
cu->SetCenter(0, -1, 0);
auto cu2 = vtkSmartPointer<vtkCubeSource>::New();
cu2->SetXLength(10);
cu2->SetYLength(5);
cu2->SetZLength(10);
cu2->SetCenter(1, 1, 1);
auto cyl = vtkSmartPointer<vtkCylinderSource>::New();
cyl->SetResolution(32);
cyl->SetHeight(5);
cyl->SetRadius(5);
cyl->SetCenter(0, 8, 0);
auto bf = vtkSmartPointer<walnut::vtkWalnutBooleanFilter>::New();
bf->AddInputConnection(cu->GetOutputPort());
bf->AddInputConnection(cyl->GetOutputPort());
bf->AddInputConnection(cu2->GetOutputPort());
bf->SetOperationToUnion();
return bf;
}
int main(int argc, char *argv[]) {
Render(GenerateShape(), "walnut_union");
return 0;
}