0
$\begingroup$

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

x1,y1,x2,y2,radius,direction

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!!

  • 0
    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.2011-03-15
  • 0
    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?2011-03-15
  • 0
    i just mean it would connect the two points. pardon my english2011-03-15
  • 0
    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?2011-03-15
  • 0
    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.2011-03-15

1 Answers 1

1

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.
  6. You have your answer. In your example, the clockwise arc crosses the bounds.
  • 0
    @henry: in #2, what do you mean there could be two centers? at least in how I'm doing this, my radius will always be, at smallest, half the distance between the two points. sometimes larger. but how does having a radius larger than distance/2 result in two arcs? in #3, how are you finding the values (-5,3.93649) and (-5,0.0635)? thanks!2011-03-15
  • 0
    ok, i see what you mean about two centers. in my case, i know which one i'm using as I know which of the two end points is the starting point and i know whether i'm going clockwise or counterclockwise from the start point.2011-03-15
  • 0
    does anyone know how henry calculated his values in step #3?2011-03-16
  • 0
    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.2011-03-16
  • 0
    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.2011-03-16
  • 0
    thank you so much henry! i also need help finding the center, so posted that in [another question](http://math.stackexchange.com/questions/27535/how-to-find-center-of-an-arc-given-start-point-end-point-radius-and-arc-direct)2011-03-17
  • 0
    henry, i'm still having trouble understanding how to calculate the boundary crossing points and the candidate centers. could you elaborate on the formulas you used? maybe give them to me in abstract form? my algebra is old and crusty, although I'm trying to improve it.2011-03-22