awv3
Version:
⚡ AWV3 embedded CAD
43 lines (36 loc) • 1.14 kB
JavaScript
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import * as THREE from 'three';
var inverseMatrix = new THREE.Matrix4();
var ray = new THREE.Ray();
var distance = 0;
var InfinitePlane =
/*#__PURE__*/
function (_THREE$Object3D) {
_inheritsLoose(InfinitePlane, _THREE$Object3D);
function InfinitePlane() {
var _this;
_this = _THREE$Object3D.call(this) || this;
_this.type = 'InfinitePlane';
_this.plane = new THREE.Plane();
return _this;
}
var _proto = InfinitePlane.prototype;
_proto.raycast = function raycast(raycaster, intersects) {
inverseMatrix.getInverse(this.matrixWorld);
ray.copy(raycaster.ray).applyMatrix4(inverseMatrix);
distance = ray.distanceToPlane(this.plane);
if (distance === null || distance < raycaster.near || distance > raycaster.far) return;
var point = new THREE.Vector3();
ray.at(distance, point);
intersects.push({
distance: distance,
distanceToRay: 0,
point: point,
index: 0,
face: null,
object: this
});
};
return InfinitePlane;
}(THREE.Object3D);
export { InfinitePlane as default };