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;
}