getTriangleList method

List<Vec6f> getTriangleList()

Returns a list of all triangles.

The function gives each triangle as a 6 numbers vector, where each two are one of the triangle vertices. i.e. p1_x = v0, p1_y = v1, p2_x = v2, p2_y = v3, p3_x = v4, p3_y = v5.

https://docs.opencv.org/4.x/df/dbf/classcv_1_1Subdiv2D.html#a26bfe32209bc8ae9ecc53e93da01e466

Implementation

List<Vec6f> getTriangleList() {
  return using<List<Vec6f>>((arena) {
    final pv = arena<ffi.Pointer<cvg.Vec6f>>();
    final psize = arena<ffi.Size>();
    cvRun(() => cffi.Subdiv2D_GetTriangleList(ref, pv, psize));
    return List.generate(psize.value, (i) {
      final v = pv.value[i];
      return Vec6f(v.val1, v.val2, v.val3, v.val4, v.val5, v.val6);
    });
  });
}