08-27-周三_17-09-29

This commit is contained in:
2025-08-27 17:10:05 +08:00
commit 86df397d8f
12735 changed files with 1145479 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
function intersectEllipse (node, rx, ry, point) {
// Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
const cx = node.x
const cy = node.y
const px = cx - point.x
const py = cy - point.y
const det = Math.sqrt(rx * rx * py * py + ry * ry * px * px)
let dx = Math.abs(rx * ry * px / det)
if (point.x < cx) {
dx = -dx
}
let dy = Math.abs(rx * ry * py / det)
if (point.y < cy) {
dy = -dy
}
return {x: cx + dx, y: cy + dy}
}
export default intersectEllipse