Skip to content

Commit

Permalink
Finish path intersection code except for one subtle bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Nov 3, 2024
1 parent 76a31cb commit fe6454e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions path_intersection.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,7 @@ func (q *SweepEvents) Remove(item *SweepPoint) {

n := len(*q) - 1
if index == -1 {
//fmt.Println(item)
//fmt.Println(q)
//panic("Item not in queue")
return
panic("Item not in queue")
} else if index < n {
q.Swap(index, n)
q.down(index, n)
Expand Down Expand Up @@ -1057,13 +1054,13 @@ func bentleyOttmann(p, q *Path, op pathOp, fillRule FillRule) *Path {
}
if !pOverlaps[i] && (op == opOR || op == opXOR || op == opNOT) {
// path bounding boxes do not overlap, thus no intersections
R = R.Append(p.Settle(fillRule))
R = R.Append(ps[i].Settle(fillRule))
}
}
for j := range qs {
if !qOverlaps[j] && (op == opOR || op == opXOR) {
// path bounding boxes do not overlap, thus no intersections
R = R.Append(q.Settle(fillRule))
R = R.Append(qs[j].Settle(fillRule))
}
}
}
Expand Down Expand Up @@ -1243,9 +1240,6 @@ func bentleyOttmann(p, q *Path, op pathOp, fillRule FillRule) *Path {
// orient holes clockwise
r = r.Reverse()
}
if r.Empty() {
fmt.Println("RESULT PATH IS EMPTY")
}
R = R.Append(r)
}
}
Expand Down
Binary file not shown.
Binary file modified resources/boolean/boolean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/docs/boolean/boolean.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/docs/boolean/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var font *canvas.FontFamily
// Shapes from http://assets.paperjs.org/boolean/
func main() {
font = canvas.NewFontFamily("latin")
if err := font.LoadSystemFont("serif", canvas.FontRegular); err != nil {
if err := font.LoadSystemFont("DejaVu Serif, serif", canvas.FontRegular); err != nil {
panic(err)
}

Expand Down

0 comments on commit fe6454e

Please sign in to comment.