applyMatrix4 method

Box3 applyMatrix4(
  1. Matrix4 matrix
)

Implementation

Box3 applyMatrix4(Matrix4 matrix) {
  // transform of empty box is an empty box.
  if (isEmpty()) return this;

  // NOTE: I am using a binary pattern to specify all 2^3 combinations below
  _points[0].set(min.x, min.y, min.z).applyMatrix4(matrix); // 000
  _points[1].set(min.x, min.y, max.z).applyMatrix4(matrix); // 001
  _points[2].set(min.x, max.y, min.z).applyMatrix4(matrix); // 010
  _points[3].set(min.x, max.y, max.z).applyMatrix4(matrix); // 011
  _points[4].set(max.x, min.y, min.z).applyMatrix4(matrix); // 100
  _points[5].set(max.x, min.y, max.z).applyMatrix4(matrix); // 101
  _points[6].set(max.x, max.y, min.z).applyMatrix4(matrix); // 110
  _points[7].set(max.x, max.y, max.z).applyMatrix4(matrix); // 111

  setFromPoints(_points);

  return this;
}