I'm working on a project to place a piece of text, programatically, in the center of each segment of a doughnut chart. To make things easier, I'm ignoring the arc of the segment and instead treating it as a triangle.
I understand that if I know the coordinates of the three triangle vertices, I can use a formula to calculate the center point.
At the moment, I know the following information about each possible triangle:
- The size of each inside angle
- Each triangle will be isosceles
- The length of the equal sides will be equal to the radius of the doughnut chart
- The x and y coordinate of one vertex will always be the midpoint of the doughnut chart, which will be equal to the radius of the doughnut chart. (Eg, given a chart with a radius of 300, the coordinate of the midpoint of the chart will be (300,300)
I have included an illustration of the above below:
On the diagram, the two coordinates I am trying to find are A and B. (A second triangle has been included to illustrate how each segment will be identical, bar the coordinates that touch the outer rim of the circle.)
Unfortunately, due to the nature of the program that I am trying to write, there are some restrictions:
- Triangles are drawn one at a time. This means that after one triangle is drawn, the values for the other are lost. It is possible for me to save these if needed, however.
- The program is designed to dynamically create a doughnut charts. This means that it may create a doughnut chart of eight segments, six, five, nine, or less or more. Therefore, if possible, the solution to this problem should also be able to work on a triangle with different values.
In advance, thank you for your help on this. I've tried to explain my problem as clearly as I can. If I haven't, please ask as many questions as you need.
Thanks!
EDIT
Two answers exist:
- For one that works out the missing two vertices of the triangle, see Henry's answer below that I have marked as correct.
- For one that solves my problem without calculating the missing vertices, see PM2Ring's answer in the comments to this question.

When you have $n$ segments, are all the centre angles the same? E.g. with $n=8$ the centre angles are all $\dfrac{360^\circ}{8}=45^\circ$?
Are your co-ordinates measured from the top left corner? So for example does Point A have co-ordinates $(300,0)$?
You might try making the $k^{\text{th}}$ triangle of $n$ have the co-ordinates $(300, 300)$ as the centre of the circle and $\left(300+300\sin\left(\dfrac{2\pi (k-1)}{ n}\right), 300-300\cos\left(\dfrac{2\pi (k-1)}{ n}\right)\right)$ and $\left(300+300\sin\left(\dfrac{2\pi k}{ n}\right), 300-300\cos\left(\dfrac{2\pi k)}{ n}\right)\right)$ on the assumption your computer applies trigonometric functions to radians
So in your illustration with $n=8$ and $k=1$ you would get Point A as $(300,0)$ and point B as about $(512, 88)$