Check GGLib[9K3KQPKF]. That library handle collisions between line, rectangles and circles.