This commit is contained in:
Gabriel Bizdoc 2025-12-24 22:44:45 +02:00
parent adcf94c5e5
commit 23d5240e07
No known key found for this signature in database
GPG Key ID: 3F0EDAECA5BE9ED9

View File

@ -79,7 +79,7 @@ func isP1InsideP2(p1, p2 []Vertex) bool {
for _, rectangleVertex := range p1 { for _, rectangleVertex := range p1 {
corner := rectangleVertex.Start // for each point of retangle corner := rectangleVertex.Start // for each point of retangle
// check if corner is on vertex. if yes we are fine // check if corner is on vertex. if yes we are fine
// count vertexes // count vertices
verticesPassed := 0 verticesPassed := 0
for _, v := range p2 { for _, v := range p2 {
if isPointOnLine(corner, v) { if isPointOnLine(corner, v) {
@ -102,11 +102,9 @@ func isP1InsideP2(p1, p2 []Vertex) bool {
func isPointOnLine(p geometry.Point, l Vertex) bool { func isPointOnLine(p geometry.Point, l Vertex) bool {
v := p.Subs(l.Start) v := p.Subs(l.Start)
w := l.End.Subs(l.Start) w := l.End.Subs(l.Start)
if v.Line*w.Col != v.Col*w.Line { if v.Line*w.Col != v.Col*w.Line {
return false return false
} }
return w.Dot(p.Subs(l.End)) <= 0 return w.Dot(p.Subs(l.End)) <= 0
} }
func polygonsIntersect(p1, p2 []Vertex) bool { func polygonsIntersect(p1, p2 []Vertex) bool {