开发者

Find the point with radius and angle

开发者 https://www.devze.com 2022-12-31 12:10 出处:网络
I\'m not a genius in geometry, I\'d like to find a point in as3 with the radius and a angle but I don\'t remember the rule, I know th开发者_JAVA技巧is should be simple!

I'm not a genius in geometry, I'd like to find a point in as3 with the radius and a angle but I don't remember the rule, I know th开发者_JAVA技巧is should be simple!

Here's an example:

alt text http://img297.imageshack.us/img297/4879/examplepr.png


as3.x = centerX + radius * cos(angle)
as3.y = centerY + radius * sin(angle)

Note that the rotation in the picture linked to is in the "negative direction". I.e, an increase of the angle, yields a counter-clockwise rotation.


Let x0, y0 be the center of the circle being considered and t be the angle theta anti-clockwise from the x-axis (right horizontal).

The point you are looking for is then

x = x0 + r*cos(t)
y = y0 + r*sin(t)


You have to adjust your calculator to degree mode before making that calculation more likley you will use angle in degree

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号