day 9
This commit is contained in:
parent
adcf94c5e5
commit
23d5240e07
@ -79,7 +79,7 @@ func isP1InsideP2(p1, p2 []Vertex) bool {
|
||||
for _, rectangleVertex := range p1 {
|
||||
corner := rectangleVertex.Start // for each point of retangle
|
||||
// check if corner is on vertex. if yes we are fine
|
||||
// count vertexes
|
||||
// count vertices
|
||||
verticesPassed := 0
|
||||
for _, v := range p2 {
|
||||
if isPointOnLine(corner, v) {
|
||||
@ -102,11 +102,9 @@ func isP1InsideP2(p1, p2 []Vertex) bool {
|
||||
func isPointOnLine(p geometry.Point, l Vertex) bool {
|
||||
v := p.Subs(l.Start)
|
||||
w := l.End.Subs(l.Start)
|
||||
|
||||
if v.Line*w.Col != v.Col*w.Line {
|
||||
return false
|
||||
}
|
||||
|
||||
return w.Dot(p.Subs(l.End)) <= 0
|
||||
}
|
||||
func polygonsIntersect(p1, p2 []Vertex) bool {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user