MCPcopy Index your code
hub / github.com/tdewolff/canvas / Overlaps

Method Overlaps

util.go:569–578  ·  view source on GitHub ↗

Overlaps returns true if both rectangles overlap.

(q Rect)

Source from the content-addressed store, hash-verified

567
568// Overlaps returns true if both rectangles overlap.
569func (r Rect) Overlaps(q Rect) bool {
570 if q.X1 <= r.X0 || r.X1 <= q.X0 {
571 // left or right
572 return false
573 } else if q.Y1 <= r.Y0 || r.Y1 <= q.Y0 {
574 // below or above
575 return false
576 }
577 return true
578}
579
580// Touches returns true if both rectangles touch (or overlap).
581func (r Rect) Touches(q Rect) bool {

Callers 4

TestRectFunction · 0.95
TestPathRelateFunction · 0.45
TileRectangleFunction · 0.45
drawFunction · 0.45

Calls

no outgoing calls

Tested by 2

TestRectFunction · 0.76
TestPathRelateFunction · 0.36