MCPcopy Create free account
hub / github.com/SolarLune/masterplan / RectIntersecting

Function RectIntersecting

rect.go:7–29  ·  view source on GitHub ↗
(a, b *sdl.FRect)

Source from the content-addressed store, hash-verified

5)
6
7func RectIntersecting(a, b *sdl.FRect) bool {
8
9 return !(a.X > b.X+b.W || a.Y > b.Y+b.H || a.X+a.W < b.X || a.Y+a.H < b.Y)
10
11 // if ra.X < rb.X {
12 // ra.X = rb.X
13 // }
14 // if ra.Y < rb.Y {
15 // ra.Y = rb.Y
16 // }
17 // if ra.X+ra.W > rb.X+rb.W {
18 // ra.W = rb.X + rb.W - ra.X
19 // }
20 // if ra.Y+ra.H > rb.Y+rb.H {
21 // ra.H = rb.Y + rb.H - ra.Y
22 // }
23 // // Letting r0 and s0 be the values of r and s at the time that the method
24 // // is called, this next line is equivalent to:
25 // //
26 // // if max(r0.Min.X, s0.Min.X) >= min(r0.Max.X, s0.Max.X) || likewiseForY { etc }
27 // return ra.W > 0 && ra.H > 0
28
29}

Callers 3

UpdateMethod · 0.85
HandleUnpinningMethod · 0.85
UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected