Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Like the outline of a rectangle with semi-circular ends. Is there a formula to describe it(like $x^2 + y^2 = r^2$ describes a circle)?

I'm sure I could Google it if I knew a name for this shape - surely something this simple must have a name?

The circles can be separate, touching, intersecting or co-incident(one circle). They will always be the same size

I need to be able to determine the co-ordinates of the intersection of the shape and a straight line at any given angle to the horizontal from the centre of the shape to the edge.

say $r=radius$ and $d=$distance between centres

For a specified $r$ and $d$ and $\angle$ from any point$(x, y)$ on the edge to midway between the centres to the horizontal. I need to find $(x, y)$

Apologies for my non-mathematical statement of the problem. I was good at maths $20$ years ago!

share|cite|improve this question
image is not displayed – Ashot Mar 8 '13 at 18:48
Related: – Blue Mar 9 '13 at 4:39
up vote 2 down vote accepted

Some people call this curve a "racetrack", especially in engineering.

You can fake an "analytic" equation. Let $L$ be the line segment between the two circle centers, and let $r$ be the radius of the circles. Then the curve has equation

$$ d(\mathbf x, L) = r$$

where $d$ denotes the usual distance function. This technique makes the curve look tidy and "analytic" and hides its piecewise nature. Good for writing papers, maybe, but not much else. To do any computations, you'll still have to go back to the piecewise form (two lines and two semi-circles).

Even tidier ... if $B$ is the unit ball in $\mathbb R^2$ then the racetrack set is $L + rB$. Actually, in this form, it might be useful for doing calculations, since quite a lot is known about how to compute with Minkowski sums. Probably not much use to the OP, but might be interesting to more erudite readers.

Regarding line intersections ... Suppose the racetrack is positioned with its center at the origin. The top line is $y=r$, the bottom line is $y=-r$, and the right-hand end is the circle with equation $(x-h)^2 + y^2 = r^2$. Here, $h$ is the "half-width" of the racetrack, between centers, so that the distance between the two semi-circle centers is $2h$.

Now, suppose we take a line through the center that has an angle $\theta$ with the $x$-axis, where $\theta \ge 0$. This line has equation $y = mx$, where $m = \tan\theta$. It intersects the top edge of the racetrack when $y=r$, and this happens when $x = r/m$. But this calculation is only valid if $r/m \le h$, i.e. if $\tan\theta \ge r/h$. On the other hand, if $\tan\theta < r/h$, then the angled line intersects the ends of the racetrack (the semi-circles). To find the $x$-coordinate of the right-hand intersection, we have to find the larger of the two solutions of the equation $(x-h)^2+(mx)^2=r^2$. After doing that, we find the corresponding $y$-value from the equation $y=mx$.

share|cite|improve this answer

This type of curve is known as a stadium:

share|cite|improve this answer

There isn't an analytic function of $x$ and $y$ whose zero-set is this curve: you would need a function defined piecewise. And to get the coordinates of your point in the last part of your question you'll want to look at cases (the point is on one semicircle, or the other, or one of the straight lines).

share|cite|improve this answer
Thanks Robert. I was starting to suspect that might be the case. Any ideas for the name though? It is a very simple shape. – Owen Smith Mar 8 '13 at 18:51
I guess that's more lexicography than maths :) Seriously, thanks again. – Owen Smith Mar 8 '13 at 18:59
Sometimes called an "oval" (e.g. when referring to a running track), although mathematically "oval" usually refers to other shapes. Wikipedia claims "oblong" is more correct. – Robert Israel Mar 8 '13 at 19:23
Maaan. I need 15 to vote you up! – Owen Smith Mar 8 '13 at 19:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.