<commit_before>import GLBoost from './globals'
import Vector3 from './math/Vector3'
import Matrix4x4 from './math/Matrix4x4'

export default class Element {
  constructor() {
    this.children = [];
    this._translate = Vector3.zero();
    this._rotate = Vector3.zero();
    this._scale = new Vector3(1, 1, 1);
    this._matrix = Matrix4x4.identity();
    this._dirty = false;
  }

  set translate(vec) {
    if (this._translate.isEqual(vec)) {
      return;
    }
    this._translate = vec;
    this._dirty = true;
  }

  get translate() {
    return this._translate;
  }

  set rotate(vec) {
    if (this._rotate.isEqual(vec)) {
      return;
    }
    this._rotate = vec;
    this._dirty = true;
  }

  get rotate() {
    return this._rotate;
  }

  set scale(vec) {
    if (this._scale.isEqual(vec)) {
      return;
    }
    this._scale = vec;
    this._dirty = true;
  }

  get scale() {
    return this._scale;
  }

  get transformMatrix() {
    if (this._dirty) {
      var matrix = Matrix4x4.identity();
      this._matrix = matrix.scale(this._scale).
        rotateX(this._rotate.x).
        rotateY(this._rotate.y).
        rotateZ(this._rotate.z).
        translate(_translate);
      this._dirty = false;
      return this._matrix.clone();
    } else {
      return this._matrix.clone();
    }
  }
}

GLBoost["Element"] = Element;<commit_msg>fix a bug of Element.transformMatrix.<commit_after>import GLBoost from './globals'
import Vector3 from './math/Vector3'
import Matrix4x4 from './math/Matrix4x4'

export default class Element {
  constructor() {
    this.children = [];
    this._translate = Vector3.zero();
    this._rotate = Vector3.zero();
    this._scale = new Vector3(1, 1, 1);
    this._matrix = Matrix4x4.identity();
    this._dirty = false;
  }

  set translate(vec) {
    if (this._translate.isEqual(vec)) {
      return;
    }
    this._translate = vec;
    this._dirty = true;
  }

  get translate() {
    return this._translate;
  }

  set rotate(vec) {
    if (this._rotate.isEqual(vec)) {
      return;
    }
    this._rotate = vec;
    this._dirty = true;
  }

  get rotate() {
    return this._rotate;
  }

  set scale(vec) {
    if (this._scale.isEqual(vec)) {
      return;
    }
    this._scale = vec;
    this._dirty = true;
  }

  get scale() {
    return this._scale;
  }

  get transformMatrix() {
    if (this._dirty) {
      var matrix = Matrix4x4.identity();
      this._matrix = matrix.scale(this._scale).
        rotateX(this._rotate.x).
        rotateY(this._rotate.y).
        rotateZ(this._rotate.z).
        translate(this._translate);
      this._dirty = false;
      return this._matrix.clone();
    } else {
      return this._matrix.clone();
    }
  }
}

GLBoost["Element"] = Element;
{'fraction_non_alphanumeric': 0.14045968624589567, 'fraction_numerical': 0.011674571324334184, 'mean_word_length': 2.352078239608802, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2594606', 'n_tokens_mistral': 932, 'n_tokens_neox': 902, 'n_words': 187}