VecVecPoint.generate constructor

VecVecPoint.generate(
  1. int length,
  2. VecPoint generator(
    1. int i
    ), {
  3. bool dispose = true,
})

Implementation

factory VecVecPoint.generate(int length, VecPoint Function(int i) generator, {bool dispose = true}) {
  final pp = calloc<cvg.VecVecPoint>()..ref.length = length;
  pp.ref.ptr = calloc<cvg.VecPoint>(length);
  for (var i = 0; i < length; i++) {
    final v = generator(i);
    pp.ref.ptr[i] = v.ref;
    if (dispose) v.dispose();
  }
  return VecVecPoint.fromPointer(pp);
}