setFromBuffer method
source - A buffer attribute of position data that the resulting box will envelop.
Sets the upper and lower bounds of this box to include all of the data in
source.
Implementation
BoundingBox setFromBuffer(BufferAttribute source) {
double minX = double.infinity;
double minY = double.infinity;
double minZ = double.infinity;
double maxX = -double.infinity;
double maxY = -double.infinity;
double maxZ = -double.infinity;
for (int i = 0, l = source.count; i < l; i++) {
double x = source.getX(i)!.toDouble();
double y = source.getY(i)!.toDouble();
double z = source.getZ(i)!.toDouble();
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.setValues(minX, minY, minZ);
max.setValues(maxX, maxY, maxZ);
return this;
}