Connecting Circles in C++/Excel
<p>This is quite complicated to explain, so I will do my best, sorry if there is anything I missed out, let me know and I will rectify it.</p>

<p>My question is, I have been tasked to draw this shape,</p>

<p><img src="http://www.learnersdictionary.com/art/ld/crescent.gif" alt="Crescent Moon"></p>

<p>This is to be done using C++ to write code that will calculate the points on this shape.</p>

<p>Important details.</p>

<p>User Input - Centre Point (X, Y), number of points to be shown, Font Size (influences radius)</p>

<p>Output - List of co-ordinates on the shape.</p>

<p>The overall aim once I have the points is to put them into a graph on Excel and it will hopefully draw it for me, at the user inputted size!</p>

<p>I know that the maximum Radius is 165mm and the minimum is 35mm. I have decided that my base [Font Size][1] shall be 20. I then did some thinking and came up with the equation. </p>

<p>Radius = (Chosen Font Size/20)*130. This is just an estimation, I realise it probably not right, but I thought it could work at least as a template.</p>

<p>I then decided that I should create two different circles, with two different centre points, then link them together to create the shape. I thought that the INSIDE line will have to have a larger Radius and a centre point further along the X-Axis (Y staying constant), as then it could cut into the outside line.*</p>

<p>*(I know this is not what it looks like on the picture, just my chain of thought as it will still give the same shape)</p>

<p>So I defined 2nd Centre point as (X+4, Y). (Again, just estimation, thought it doesn't really matter how far apart they are).</p>

<p>I then decided Radius 2 = (Chosen Font Size/20)*165 (max radius)</p>

<p>So, I have my 2 Radii, and two centre points.</p>

<p>This is my code so far (it works, and everything is declared/inputted above)</p>

<pre><code>for(int i=0; i&lt;=n; i++) //output displayed to user
{                                          
Xnew = -i*(Y+R1)/n; //calculate x coordinate
Ynew = pow((((Y+R1)*(Y+R1)) - (Xnew*Xnew)), 0.5); //calculate y coordinate
</code></pre>

<p>AND</p>

<pre><code> for(int j=0; j&lt;=n; j++)//calculation for angles and output displayed to user
{
Xnew2 = -j*(Y+R2)/((n)+((0.00001)*(n==0))); //calculate x coordinate
Ynew2 = Y*(pow(abs(1-(pow((Xnew2/X),2))),0.5));
if(abs(Ynew2) &lt;= R1)
    cout&lt;&lt;"\n("&lt;&lt;Xnew2&lt;&lt;", "&lt;&lt;Ynew2&lt;&lt;")"&lt;&lt;endl;
</code></pre>

<p>I am having the problem drawing the crescent moon that I cannot get the two circles to have the same starting point?</p>

<p>I have managed to get the results to Excel. Everything in that regard works. But when i plot the points on a graph on Excel, they do not have the same starting points. Its essentially just two half circles, one smaller than the other (Stops at the Y axis, giving the half doughnut shape). </p>

<p>If this makes sense, I am trying to get two parts of circles to draw the shape as such that they have the same start and end points. </p>

<p>If anyone has any suggestions on how to do this, it would be great, currently all I am getting more a 'half doughnut' shape, due to the circles not being connected.</p>

<p>So. Does anyone have any hints/tips/links they can share with me on how to fix this exactly? </p>

<p>Thanks again, any problems with the question, sorry will do my best to rectify if you let me know. </p>

<p>Cheers</p>
