<commit_before>define(['pex/geom/Vec3'], function(Vec3) {
  function BoundingBox(min, max) {
    this.min = min;
    this.max = max;
  }

  /*
  BoundingBox.fromPositionSize = function(pos, size) {
    return new BoundingBox(
      Vec3.fromValues(pos[0] - size[0]/2, pos[1] - size[1]/2, pos[2] - size[2]/2),
      Vec3.fromValues(pos[0] + size[0]/2, pos[1] + size[1]/2, pos[2] + size[2]/2)
    );
  }
*/
  BoundingBox.fromPoints = function(points) {
    var bbox = new BoundingBox(Vec3.clone(points[0], Vec3.clone(points[0])));
    points.forEach(bbox.addPoint.bind(bbox));
    return bbox;
  }

  BoundingBox.prototype.isEmpty = function() {
    if (!this.min || !this.max) return true;
    if (this.min[0] == this.max[0] && this.min[1] == this.max[1] && this.min[2] == this.max[2]) return true;
    else return false;
  }

  BoundingBox.prototype.addPoint = function(p) {
    if (this.isEmpty()) {
      this.min = Vec3.clone(p);
      this.max = Vec3.clone(p);
    }

    if (p[0] < this.min[0]) this.min[0] = p[0];
    if (p[1] < this.min[1]) this.min[1] = p[1];
    if (p[2] < this.min[2]) this.min[2] = p[2];
    if (p[0] > this.max[0]) this.max[0] = p[0];
    if (p[1] > this.max[1]) this.max[1] = p[1];
    if (p[2] > this.max[2]) this.max[2] = p[2];
  }

  BoundingBox.prototype.getSize = function(out) {
    if (!out) {
      if (!this.size) {
        this.size = Vec3.create();
      }
      out = this.size;
    }

    if (this.isEmpty()) {
      Vec3.set(out, 0, 0, 0);
      return;
    }

    Vec3.set(out,
     (this.max[0] - this.min[0]),
     (this.max[1] - this.min[1]),
     (this.max[2] - this.min[2])
    );
    return out;
  }<commit_msg>Finished BoundingBox<commit_after>define(['pex/geom/Vec3'], function(Vec3) {
  function BoundingBox(min, max) {
    this.min = min;
    this.max = max;
  }

  BoundingBox.fromPositionSize = function(pos, size) {
    return new BoundingBox(
      Vec3.fromValues(pos[0] - size[0]/2, pos[1] - size[1]/2, pos[2] - size[2]/2),
      Vec3.fromValues(pos[0] + size[0]/2, pos[1] + size[1]/2, pos[2] + size[2]/2)
    );
  }

  BoundingBox.fromPoints = function(points) {
    var bbox = new BoundingBox(Vec3.clone(points[0], Vec3.clone(points[0])));
    points.forEach(bbox.addPoint.bind(bbox));
    return bbox;
  }

  BoundingBox.prototype.isEmpty = function() {
    if (!this.min || !this.max) return true;
    if (this.min[0] == this.max[0] && this.min[1] == this.max[1] && this.min[2] == this.max[2]) return true;
    else return false;
  }

  BoundingBox.prototype.addPoint = function(p) {
    if (this.isEmpty()) {
      this.min = Vec3.clone(p);
      this.max = Vec3.clone(p);
    }

    if (p[0] < this.min[0]) this.min[0] = p[0];
    if (p[1] < this.min[1]) this.min[1] = p[1];
    if (p[2] < this.min[2]) this.min[2] = p[2];
    if (p[0] > this.max[0]) this.max[0] = p[0];
    if (p[1] > this.max[1]) this.max[1] = p[1];
    if (p[2] > this.max[2]) this.max[2] = p[2];
  }

  BoundingBox.prototype.getSize = function(out) {
    if (!out) {
      if (!this.size) {
        this.size = Vec3.create();
      }
      out = this.size;
    }

    if (this.isEmpty()) {
      Vec3.set(out, 0, 0, 0);
      return out;
    }

    Vec3.set(out,
     (this.max[0] - this.min[0]),
     (this.max[1] - this.min[1]),
     (this.max[2] - this.min[2])
    );
    return out;
  }
{'fraction_non_alphanumeric': 0.21334134615384615, 'fraction_numerical': 0.042067307692307696, 'mean_word_length': 2.5950323974082075, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4411659', 'n_tokens_mistral': 1437, 'n_tokens_neox': 1395, 'n_words': 242}