David
David

Reputation: 69

Radial plotting algorithm

I have to write an algorithm in AS3.0 that plots the location of points radially. I'd like to input a radius and an angle at which the point should be placed. Obviously I remember from geometry coursework that 2(pi)r will give me an x on the point at the radius distance. The problem is I need to produce the x, y and the calculation is a bit more complicated.

A small push (or answer) would be wonderful.

Thanks.

Upvotes: 1

Views: 292

Answers (1)

Jacob
Jacob

Reputation: 34601

Conversion from polar coordinates (r,theta) to cartesian coordinates (x,y):

x = xc + r cos(theta)
y = yc + r sin(theta)

where r = radius and theta = angle in radians and (xc,yc) is the center of the circle

Upvotes: 1

Related Questions