MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / PointVec2Poly

Function PointVec2Poly

paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc:73–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72template <class T>
73void 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
90template <class T>
91void Poly2PointVec(const funcs::gpc_vertex_list& contour,

Callers

nothing calls this directly

Calls 2

mallocFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected