VecVec6f.generate constructor

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

Implementation

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