math - android Dividing circle into N equal parts and know the coordinates of each dividing point -


i have requirement circle should divided n equal parts based on number(2,3...n. want coordinates of dividing points.

i have circle centre(x,y) , radius(150) known.

question:

is there formula gives me coordinates of dividing points shown in figure. can please tell me formula. want implement in java.

circle image refrence:

image

you need convert between polar , cartesian coordinates. angle need angle between (imaginary) vertical line splits circle in half , line connects center circle's boundary. formula can calculate x , y offsets center.

in example image first angle 0, , second 1 360/n. each next i*(360/n) index of current line need draw. applying give x , y offsets in clockwise order (and can add them x , y coordinates of center find coordinates of each point)

edit: kind of pseudo-code:

//x0, y0 - center's coordinates for(i = 1 n) {     angle = * (360/n);     point.x = x0 + r * cos(angle);     point.y = y0 + r * sin(angle); } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -