RectsOverlap

BlitzMax Forums/BlitzMax Beginners Area/RectsOverlap

Shagwana did a nice n fast one. I've adapted it to use in a Bmax TRectangle type.

Type TRectangle

	Method Intersect:Int( rect:TRectangle )
		'// Thanks to Shagwana for this
		return ( ( ( ( (rect.X + rect.W) - X) ^ ( rect.X - (X + W) ) ) And ( ( rect.Y - (Y + H) ) ^ ( (rect.Y + rect.H) - Y ) ) ) And $80000000 )
	End Method
End Type


This one is fast, but might give weird results with negative coordinates.