I am working on a pie chart where i have drawn arcs with known sweeping angles.Now i want to display labels in center of each Arc, or say draw a line from center of each Arc.
Given that i know center coordinates,start coordinates,sweep angle and radius,I want to Calculate the end coordinates.
I have also tried this by drawing a triangle matching all coordinates and use Distance formula also but i don’t know how to solve equations in java.
Kindly provide me an appropriate solution.
Work in vectors. Let the
Abe the vector from circle centre to the arc start. Calculate this byLet
thetabe the sweep angle (work in radians). Use a rotation matrix to rotate the arc start around the circle centre. http://en.wikipedia.org/wiki/Rotation_matrixExplicitly,
where
A_xis x component ofA(and similarly forA_y). Thenis the point you want. It may be that the point appears rotated the wrong way (anticlockwise) and if so, just use
instead. This should work for you.
If you want to evaluate the mid-point of the arc, just use