setFromPoints method

BufferGeometry setFromPoints(
  1. dynamic points
)

Implementation

BufferGeometry setFromPoints(points) {
  List<double> position = [];

  for (var i = 0, l = points.length; i < l; i++) {
    var point = points[i];

    if (point.type == "Vector2") {
      position.addAll([point.x, point.y, 0.0]);
    } else {
      position.addAll([point.x, point.y, point.z ?? 0]);
    }
  }

  final array = Float32Array.from(position);
  setAttribute('position', Float32BufferAttribute(array, 3, false));

  return this;
}