setFromArray method

Box3 setFromArray(
  1. List<double> array
)

Implementation

Box3 setFromArray(List<double> array) {
  var minX = Infinity;
  var minY = Infinity;
  var minZ = Infinity;

  var maxX = -Infinity;
  var maxY = -Infinity;
  var maxZ = -Infinity;

  for (var i = 0, l = array.length; i < l; i += 3) {
    var x = array[i];
    var y = array[i + 1];
    var z = array[i + 2];

    if (x < minX) minX = x;
    if (y < minY) minY = y;
    if (z < minZ) minZ = z;

    if (x > maxX) maxX = x;
    if (y > maxY) maxY = y;
    if (z > maxZ) maxZ = z;
  }

  min.set(minX, minY, minZ);
  max.set(maxX, maxY, maxZ);

  return this;
}