added bounds function and segline to intersect function

This commit is contained in:
Doc
2025-09-10 10:50:03 +02:00
parent e69e1967bb
commit 9e89ce4d95
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
package geom
func SegLineIntersect(A, B, O, D Vec) (bool, float64) {
r := Sub(B, A)
den := Cross(r, D)
if NearlyZero(den) {
return false, 0
}
t := Cross(Sub(O, A), D) / den
return t > EPS && t < 1-EPS, t
}