0

I need to draw a pie graph with slices similar to the following...

enter image description here

The required information I need to draw a single slice is the X & Y coordinate of the origin of the slice and the angle of the slice. Not too difficult to draw a single slice. However to draw slices in the fashion shown above, a new origin is required for each slice which is denoted by red dots in the image.

I can't seem to figure out a generic algorithm or formula to determine the origin of the next slice. Math is not my strongest point, but any guidance would be helpful.

Alex Fu
  • 101
  • I don't think "origin" is the correct term for what you're describing. "Origin," in mathematics, means the point (0,0)... basically, the exact center of symmetry of your circle. On the other hand, if you're carving your circle into $n$ pieces, you'll need to start a new slice every $360/n$ degrees – Tyler Nov 02 '13 at 03:18
  • Are the red dots centered on the center of the circle? If so, just use a smaller radius and the same calculation of $\cos \theta, \sin \theta$ If not, how is the center chosen? You can still add the coordinates of the center to the results of the angle calculation. – Ross Millikan Nov 02 '13 at 04:16

1 Answers1

1

enter image description hereHint: You have 12 slices so the central angle $360^0$ is going to be divided by 12 which will give you the angle of separation for each slice, ie. ($\frac{360^0}{12}=30^0$).

This is literally the unit circle( just use a pie of radius 1), anddelete the angles $45,135,225,315$. Lastly, just write equations for line that go through those points and the origin, Notice you will only need to make 4 equations of lines.

Mr.Fry
  • 5,003
  • 3
  • 19
  • 28
  • Also note that the coordinates given are the $(\cos \theta , \sin \theta )$ of angle, in case you need to calculate weird values, like if you want to make $17$ slices for some reason. – Tyler Nov 02 '13 at 03:32