VecPoint3f.generate constructor

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

Implementation

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