Probably you're trying to do too much. Split it down into simple tasks, have a go and see how far you get.

Try what I said. Google for an algorithm - and you might even find code already written - for how to find the two points where a line intersects a circle.

Have a think about how you might determine which of the two arcs is smaller. Draw it out on some paper and see if you can find an approach that will let you centre (<- that word is a REALLY BIG HINT) on a solution.