| 71 | |
| 72 | template <class T> |
| 73 | void PointVec2Poly(const std::vector<Point_<T>>& vec, |
| 74 | funcs::gpc_polygon* poly) { |
| 75 | size_t pts_num = vec.size(); |
| 76 | (*poly).num_contours = 1; |
| 77 | (*poly).hole = reinterpret_cast<int*>(malloc(sizeof(int))); // NOLINT |
| 78 | (*poly).hole[0] = 0; |
| 79 | (*poly).contour = (funcs::gpc_vertex_list*)malloc( // NOLINT |
| 80 | sizeof(funcs::gpc_vertex_list)); |
| 81 | (*poly).contour->num_vertices = pts_num; |
| 82 | (*poly).contour->vertex = (funcs::gpc_vertex*)malloc( // NOLINT |
| 83 | sizeof(funcs::gpc_vertex) * pts_num); |
| 84 | for (size_t i = 0; i < pts_num; ++i) { |
| 85 | (*poly).contour->vertex[i].x = vec[i].x; |
| 86 | (*poly).contour->vertex[i].y = vec[i].y; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | template <class T> |
| 91 | void Poly2PointVec(const funcs::gpc_vertex_list& contour, |