containsPoint method

dynamic containsPoint(
  1. dynamic point
)

Implementation

containsPoint(point) {
  v1.subVectors(point, this.center);
  this.rotation.extractBasis(xAxis, yAxis, zAxis);

  // project v1 onto each axis and check if these points lie inside the OBB

  return Math.abs(v1.dot(xAxis)) <= this.halfSize.x &&
      Math.abs(v1.dot(yAxis)) <= this.halfSize.y &&
      Math.abs(v1.dot(zAxis)) <= this.halfSize.z;
}