33#include < CGAL/Polygon_2.h>
44#include < CGAL/create_straight_skeleton_2.h>
55#include < CGAL/create_straight_skeleton_from_polygon_with_holes_2.h>
6- #include < CGAL/create_offset_polygons_2.h>
76
87typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
98typedef K::Point_2 Point;
@@ -13,8 +12,6 @@ typedef CGAL::Straight_skeleton_2<K> Ss;
1312typedef boost::shared_ptr<Ss> SsPtr;
1413typedef CGAL::Straight_skeleton_2<K>::Halfedge_const_handle Halfedge_const_handle;
1514typedef CGAL::Straight_skeleton_2<K>::Vertex_const_handle Vertex_const_handle;
16- typedef boost::shared_ptr<Polygon_2> PolygonPtr;
17- typedef std::vector<PolygonPtr> PolygonPtrVector;
1815
1916compas::Edges pmp_create_interior_straight_skeleton (
2017 Eigen::Ref<const compas::RowMatrixXd> &V)
@@ -89,52 +86,6 @@ compas::Edges pmp_create_interior_straight_skeleton_with_holes(
8986
9087}
9188
92- std::vector<compas::RowMatrixXd> pmp_create_offset_polygons_2_inner (Eigen::Ref<const compas::RowMatrixXd> &V, double &offset){
93- Polygon_2 poly;
94- for (int i = 0 ; i < V.rows (); i++){
95- poly.push_back (Point (V (i, 0 ), V (i, 1 )));
96- }
97- PolygonPtrVector offset_polygons = CGAL::create_interior_skeleton_and_offset_polygons_2 (offset, poly);
98-
99- std::vector<compas::RowMatrixXd> result;
100- for (auto pi = offset_polygons.begin (); pi != offset_polygons.end (); ++pi){
101- std::size_t n = (*pi)->size ();
102- compas::RowMatrixXd points (n, 3 );
103- int j = 0 ;
104- for (auto vi = (*pi)->vertices_begin (); vi != (*pi)->vertices_end (); ++vi){
105- points (j, 0 ) = (double )(*vi).x ();
106- points (j, 1 ) = (double )(*vi).y ();
107- points (j, 2 ) = 0 ;
108- j++;
109- }
110- result.push_back (points);
111- }
112- return result;
113- }
114-
115- std::vector<compas::RowMatrixXd> pmp_create_offset_polygons_2_outer (Eigen::Ref<const compas::RowMatrixXd> &V, double &offset){
116- Polygon_2 poly;
117- for (int i = 0 ; i < V.rows (); i++){
118- poly.push_back (Point (V (i, 0 ), V (i, 1 )));
119- }
120- PolygonPtrVector offset_polygons = CGAL::create_exterior_skeleton_and_offset_polygons_2 (offset, poly);
121-
122- std::vector<compas::RowMatrixXd> result;
123- for (auto pi = offset_polygons.begin (); pi != offset_polygons.end (); ++pi){
124- std::size_t n = (*pi)->size ();
125- compas::RowMatrixXd points (n, 3 );
126- int j = 0 ;
127- for (auto vi = (*pi)->vertices_begin (); vi != (*pi)->vertices_end (); ++vi){
128- points (j, 0 ) = (double )(*vi).x ();
129- points (j, 1 ) = (double )(*vi).y ();
130- points (j, 2 ) = 0 ;
131- j++;
132- }
133- result.push_back (points);
134- }
135- return result;
136- }
137-
13889// ===========================================================================
13990// PyBind11
14091// ===========================================================================
@@ -153,16 +104,4 @@ void init_straight_skeleton_2(pybind11::module &m)
153104 &pmp_create_interior_straight_skeleton_with_holes,
154105 pybind11::arg (" V" ).noconvert (),
155106 pybind11::arg (" holes" ).noconvert ());
156-
157- submodule.def (
158- " create_offset_polygons_2_inner" ,
159- &pmp_create_offset_polygons_2_inner,
160- pybind11::arg (" V" ).noconvert (),
161- pybind11::arg (" offset" ).noconvert ());
162-
163- submodule.def (
164- " create_offset_polygons_2_outer" ,
165- &pmp_create_offset_polygons_2_outer,
166- pybind11::arg (" V" ).noconvert (),
167- pybind11::arg (" offset" ).noconvert ());
168107};
0 commit comments