如何计算圆周上的一个点? [英] How do I calculate a point on a circle’s circumference?

查看:66
本文介绍了如何计算圆周上的一个点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用各种语言实现以下功能?

How can the following function be implemented in various languages?

计算圆周上的 (x,y) 点,给定输入值:

Calculate the (x,y) point on the circumference of a circle, given input values of:

  • 半径
  • 角度
  • 来源(可选参数,如果语言支持)

推荐答案

圆的参数方程

x = cx + r * cos(a)
y = cy + r * sin(a)

其中 r 是半径,cx,cy 是原点,a 是角度.

Where r is the radius, cx,cy the origin, and a the angle.

这很容易适应任何具有基本触发功能的语言.请注意,大多数语言将使用 弧度 作为三角函数中的角度,而不是循环通过 0..360 度,您正在循环通过 0..2PI 弧度.

That's pretty easy to adapt into any language with basic trig functions. Note that most languages will use radians for the angle in trig functions, so rather than cycling through 0..360 degrees, you're cycling through 0..2PI radians.

这篇关于如何计算圆周上的一个点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆