Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

For a computer game (which means the origin is on the top left) I need to place 12 dots equidistantly on a circle.

The curve should also go through the 3 red dots shown below:

enter image description here

Here is how I am trying to solve it:

The dots on the curve must have the coordinates:

x = R * cos(alpha + beta) + p
y = R * sin(alpha + beta) + q

The R, beta, p and q are unknown to me, but alpha goes from 0 to $\pi$/3 in 12 steps and I know w, h and b.

And I know that the curve should contain the 3 red dots:

(0, h - 2b) when alpha is 0
(w/2, h - 3b) when alpha is pi/6
(w, h - 2b) when alpha is pi/3

So this gives me 6 equations to solve:

0 = R cos(beta) + p
h - 2b = R sin(beta) + q

w/2 = R cos(pi/6 + beta) + p
h - 3b = R sin(pi/6 + beta) + q

w = R cos(pi/3 + beta) + p
h - 2b = R sin(pi/3 + beta) + q

The above equations should provide me with R, beta, p and q - right?

And then I could place my 12 dots (they are actually midpoints of playing cards) by running this loop:

for (i = 0; i < 12; i++) {
    card.x = R * Math.cos(i * Math.PI / 36) + p;
    card.y = R * Math.sin(i * Math.PI / 36) + q;
}

Unfortunately, I don't know how to solve the 6 equations above (except that p is probably w/2).

Can you please help me or suggest a better way?

Below is the current screenshot of my card game, where I am trying to place the bottom cards on a curve (around the player avatar):

enter image description here

UPDATE: I've given up the curve for the moment and tried to solve the equation

y = px^2 + qx + r

for the 3 dots and got:

p = 4b / w^2
q = - pw
r = h - 2b

This gives me quite nice card placement:

enter image description here

But if someone posts a complete solution for the curve, that would be great.

My math skills are too rusty and I probably do some basic errors while solving...

share|improve this question
    
so would you prefer the cards to be on a circular or on a parabolic curve? –  long tom Mar 25 '13 at 9:29
    
Actually they look good enough now on a parabolic curve, but I am curious about the solution to the "real" curve too. –  Alexander Farber Mar 25 '13 at 10:07
add comment

1 Answer

I'd try to find the radius of the circle by solving $r^2=(r-b)^2+(w/2)^2$.
The angle $\gamma$ between the radii to the outer spots (on the border of the screen) should be the solution of $\sin \gamma/2=\dfrac{w/2}{r}$.
I think some fiddling with that could lead you somewhere?

(indeed $p=w/2$, $q=h+r-3b$)

share|improve this answer
    
The angle between the radii to the outer spot - can't I deliberately set it to $\pi$/3? (i.e. I wonder: how many circles can go through 3 dots?) –  Alexander Farber Mar 23 '13 at 19:35
1  
3 dots determine exactly one circle –  long tom Mar 23 '13 at 19:46
1  
@Alexander: If you want to keep the angle to $\pi/3$, you need to change those $2b$, $3b$ numbers. –  Jyrki Lahtonen Mar 23 '13 at 19:53
    
If you want to keep the angle to $\pi/3$ and keep $2b$ (but not $3b$), then $r=w$ –  long tom Mar 23 '13 at 20:17
    
No, I must keep the dots - not much space for cards at the mobile phone screen otherwise... –  Alexander Farber Mar 23 '13 at 20:40
add comment

Your Answer

 
discard

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.