UNPKG

@itwin/core-frontend

Version:
29 lines 1.16 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Utils */ Object.defineProperty(exports, "__esModule", { value: true }); exports.linePlaneIntersect = linePlaneIntersect; /** @internal */ function linePlaneIntersect(outP, linePt, lineNormal, planePt, planeNormal, perpendicular) { let dot = 0; if (lineNormal) dot = lineNormal.dotProduct(planeNormal); else perpendicular = true; let temp; if (perpendicular || Math.abs(dot) < .001) { const t = linePt.vectorTo(planePt).dotProduct(planeNormal); temp = planeNormal.scale(t); } else { const t = (planeNormal.dotProduct(planePt) - planeNormal.dotProduct(linePt)) / dot; temp = lineNormal.scale(t); } outP.setFrom(temp.plus(linePt)); } //# sourceMappingURL=LinePlaneIntersect.js.map