Calculate point P(x,y) in a circle given a radius and angle degree

2k Views Asked by At

I'm doing a program in Java to draw a PieChart based on given value as link below.

data for piechart

Given that the diameter, radius, angle degree, center point (150,150) and First Point A (150,0) for each value of (x, y) respectively for piechart as below:

piechart diameter, radius and angle degree

The problem is that I cannot complete my program, because I do not understand how to calculate the next Point B (x,y), Point C (x,y), Point D (x,y) and Point E (x,y).

Is it possible to get the value of those point? I'm not a math student and doing simple java programming consisting math calculation is simply my interest. I'm much appreciated to anyone who can help me on this problem.

1

There are 1 best solutions below

4
On

It would be much easier if we let the circle’s radius = r and center = O(0, 0).

enter image description here

To a data point P(x, y) on the circumference with its central angle α known, means that point is given in polar co-ordinate in the form [r, α].

The inter-relationship between (x, y) and [r, α] is {x = r* cos α, and y = r * sin α}.

Note that all angles are measured counter-clockwise-ly from the first point (the positive x-axis).

If Q(m, n) is the next point whose included central angle is β, then Q, in polar co-ordinates, is [r, δ]; where δ = β + α.