更新配置,能够简单运行实例.
This commit is contained in:
48
dist/PlaneExt.js
vendored
48
dist/PlaneExt.js
vendored
@@ -1,48 +0,0 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var THREE = require("three");
|
||||
var three_1 = require("three");
|
||||
var PlaneExt = /** @class */ (function (_super) {
|
||||
__extends(PlaneExt, _super);
|
||||
function PlaneExt(normal, constant) {
|
||||
return _super.call(this, normal, constant) || this;
|
||||
}
|
||||
PlaneExt.prototype.intersectLine = function (line, optionalTarget, extendLine) {
|
||||
var v1 = new three_1.Vector3();
|
||||
var result = optionalTarget || new three_1.Vector3();
|
||||
var direction = line.delta(v1);
|
||||
var denominator = this.normal.dot(direction);
|
||||
if (denominator === 0) {
|
||||
// line is coplanar, return origin
|
||||
if (this.distanceToPoint(line.start) === 0) {
|
||||
return result.copy(line.start);
|
||||
}
|
||||
// Unsure if this is the correct method to handle this case.
|
||||
return undefined;
|
||||
}
|
||||
var t = -(line.start.dot(this.normal) + this.constant) / denominator;
|
||||
//If you not extendLine,check intersect point in Line
|
||||
if (!extendLine && (t < 0 || t > 1)) {
|
||||
return undefined;
|
||||
}
|
||||
return result.copy(direction).multiplyScalar(t).add(line.start);
|
||||
};
|
||||
PlaneExt.prototype.intersectRay = function (ray, optionalTarget, extendLine) {
|
||||
// 从射线初始位置
|
||||
var line = new THREE.Line3(ray.origin.clone(), ray.origin.clone().add(ray.direction));
|
||||
return this.intersectLine(line, optionalTarget, extendLine);
|
||||
};
|
||||
return PlaneExt;
|
||||
}(THREE.Plane));
|
||||
exports.PlaneExt = PlaneExt;
|
||||
//# sourceMappingURL=PlaneExt.js.map
|
||||
Reference in New Issue
Block a user