forked from boostorg/geometry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path08_polyhedralsurface_example.cpp
More file actions
36 lines (26 loc) · 1.46 KB
/
08_polyhedralsurface_example.cpp
File metadata and controls
36 lines (26 loc) · 1.46 KB
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
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Polyhedral surface example
#include <iostream>
#include <boost/geometry/geometry.hpp>
int main()
{
using namespace boost::geometry;
using point_t = model::point<double, 3, cs::cartesian>;
using ring_t = model::ring<point_t>;
using polyhedral_t = model::polyhedral_surface<ring_t>;
// intializing an empty polyhedral surface (deafault constructor)
polyhedral_t polyhedral2;
// creating a polyhderal surface using standard initiallized list
polyhedral_t polyhedral1 = {{{0,0,0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}, {0, 0, 0}}, {{0, 0, 0}, {0, 1, 0}, {0, 1, 1}, {0, 0, 1}, {0, 0, 0}},
{{0, 0, 0}, {1, 0, 0}, {1, 0, 1}, {0, 0, 1}, {0, 0, 0}}, {{1, 1, 1}, {1, 0, 1}, {0, 0, 1}, {0, 1, 1}, {1, 1, 1}}, {{1, 1, 1}, {1, 0, 1}, {1, 0, 0}, {1, 1, 0}, {1, 1, 1}},
{{1, 1, 1}, {1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {1, 1, 1}}};
// modifying a polyhedral surface
polyhedral1[0][1] = {1, 1, 1};
// read polyhedral surface wkt
read_wkt("POLYHEDRALSURFACE(((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),((0 0 0, 0 1 0, 0 1 1, 0 0 1, 0 0 0)),((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),((1 1 1, 1 0 1, 0 0 1, 0 1 1, 1 1 1)),((1 1 1, 1 0 1, 1 0 0, 1 1 0, 1 1 1)),((1 1 1, 1 1 0, 0 1 0, 0 1 1, 1 1 1)))", polyhedral2);
// write polyhedral surface wkt
std::cout << wkt(polyhedral1) << std::endl;
std::cout << wkt(polyhedral2) << std::endl;
// clear polyhedral surface
clear(polyhedral1);
}