Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getLinePlaneIntersection (line, planeNormal, pointOnPlane) {
const [p0, p1] = line
const dir = vec3.subtract([], p1, p0)
const t = vec3.dot(vec3.subtract([], pointOnPlane, p0), planeNormal) / vec3.dot(dir, planeNormal)
return t >= 0 && t <= 1 ? vec3.add([], vec3.scale([], dir, t), p0) : null
}
function getLinePlaneIntersection (line, planeNormal, pointOnPlane) {
const [p0, p1] = line
const dir = vec3.subtract([], p1, p0)
const t = vec3.dot(vec3.subtract([], pointOnPlane, p0), planeNormal) / vec3.dot(dir, planeNormal)
return t >= 0 && t <= 1 ? vec3.add([], vec3.scale([], dir, t), p0) : null
}
function getLinePlaneIntersection (line, planeNormal, pointOnPlane) {
const [p0, p1] = line
const dir = vec3.subtract([], p1, p0)
const t = vec3.dot(vec3.subtract([], pointOnPlane, p0), planeNormal) / vec3.dot(dir, planeNormal)
return t >= 0 && t <= 1 ? vec3.add([], vec3.scale([], dir, t), p0) : null
}
function getLinePlaneIntersection (line, planeNormal, pointOnPlane) {
const [p0, p1] = line
const dir = vec3.subtract([], p1, p0)
const t = vec3.dot(vec3.subtract([], pointOnPlane, p0), planeNormal) / vec3.dot(dir, planeNormal)
return t >= 0 && t <= 1 ? vec3.add([], vec3.scale([], dir, t), p0) : null
}
function getLinePlaneIntersection (line, planeNormal, pointOnPlane) {
const [p0, p1] = line
const dir = vec3.subtract([], p1, p0)
const t = vec3.dot(vec3.subtract([], pointOnPlane, p0), planeNormal) / vec3.dot(dir, planeNormal)
return t >= 0 && t <= 1 ? vec3.add([], vec3.scale([], dir, t), p0) : null
}