how to tell if an arc is within bounds?

Let's say I'm specifying a circular arc with the following information:

and that I have 2D boundaries of: minX = -5, minY = -5, maxX = 5, maxY = 5

how can i tell if the arc will go outside the boundaries?

so, for example, an arc with these values would go outside the bounds:

-4.5,0,-4.5,4,2,clockwise

in fact, it's almost entirely outside the bounds. but if I change the radius to 6, it won't. (or if I change the direction to ccw of course)

thanks for any help!!

-
For your given coordinates and radius, an arc with its center at $x=-4.5$ and $y=2$ would join them. There can be two arcs. One remains within the bounds you specify and the other does not. This also turns out to be clockwise. – Please Delete Account Mar 15 '11 at 7:20
i may have confused the issue. i'm talking about an arc that starts at x1,y1, and ends at x2,y2, with a radius. so in my example, radius of 2 gives me half a circle. anyway, what do you mean by "join" them? – mix Mar 15 '11 at 7:44
i just mean it would connect the two points. pardon my english – Please Delete Account Mar 15 '11 at 7:59
ah, so you're talking about an arc with a different radius, right? is there a formula I can use to detect whether my arc will go out of bounds? – mix Mar 15 '11 at 8:13
In general, this is how you analyze. For $(x_1,y_1)$ and $(x_2,y_2)$ with a given radius, you can at most find four arcs staisfying your conditions. These correspond to the "longer" and "smaller" arcs with two symmetric centers $(x_0,y_0)$ and $(-x_0,-y_0)$. What remains is to check which of these remain in bound. I cannot think of a single formula, but only a bunch of inequalities. Though it should be easy to pick them out geometrically. In general possibility exists that there is no such arc. Just think of trying to remain within the bound by connecting the opposite vertices of the square. – Please Delete Account Mar 15 '11 at 8:48

This attempts a systematic approach:

1. Check your two points are inside the bounds. In your example they are.
2. Find the centre of the circular arc, which lies on the perpendicular bisector between the two points. Note that if the distance between the two points is not twice the radius then there will be two such points meaning two such centres and so two different arcs. In your example the distance is twice the radius and the centre is $(-4.5,2)$.
3. Find the (real) points where the circle meets the extended bounds. There will be up to 2 for each bound. If there is just one then the circle touches the bound rather than going outside, so this can be ignored. In your example it meets the bounds at about $(-5,3.93649)$ and $(-5,0.0635)$ where the decimals are $(4\pm \sqrt{15})/2$.
4. Drop any of these points which are outside the other bounds. In your example you do not drop anything so still have the two points where the circle meets the bounds.
5. Decide on which side of the line which joins the two initial points the points on the circle and bounds lie. You could do this by looking at angle bearings from the centre of the various points. In your example, both of the two points where the circle meets the bounds lie on the clockwise side of the line.
Since I was looking for where the circle crosses a line, I solved the simultaneous equations $x=-5$ and $(x+4.5)^2+(y-2)^2 = 2^2$ which becomes $(y-2)^2 = 15/4$ and hence my values. – Henry Mar 16 '11 at 9:21
As for the two centres, if with arc end points $(-4.5,0)$ and $(-4.5,4)$, the radius had been 2.5 rather than 2, then the possible centres would be $(-6,2)$ and $(-3,2)$. Each centre would have two arcs (one clockwise and one anti-clockwise), making four in total. – Henry Mar 16 '11 at 10:20