UNPKG

@itwin/core-frontend

Version:
26 lines 1.04 kB
/*--------------------------------------------------------------------------------------------- * 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 */ /** @internal */ export 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