在圆中找到弦点 [英] Find tanget Point in Circle
本文介绍了在圆中找到弦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给出此草图:
是否有可能知道您所知道的任何切点(蓝色的):
Is it possible to find any tangent point (The blue ones) giving that you know:
- 圆的中心点(宽度/2,宽度/2).
- 将未知点连接到中心的直线的度角(该角度是从CW方向上的
start angle
点计算的).
- The center point of the circle (width/2, width/2).
- the degree angle of the line connecting the unknown point to the center (the angle is calculated from
start angle
point in CW direction).
谢谢.
推荐答案
是的,肯定有可能.
半径为width/2
.
您知道角度,三角也是如此.
You know the angle, so do the trigonometry.
这是一些代码:
double radius = width/2;
double x = (radius)*Math.cos(-angle); // angle is in radians
double y = (radius)*Math.sin(-angle);
如果角度为度,则可以将其更改为这样的弧度.
If the angle is in degrees, you can change it to radians like this.
angle = angle/180.0*Math.PI;
编辑
由于只需要正值,因此可以使用已经计算出的x
和y
.
Since you only want positive values, you can do this with your already-calculated x
and y
.
x += radius;
y = radius - y;
单位圆上的视频: http ://www.khanacademy.org/math/trigonometry/v/unit-circle-definition-of-trig-functions
这篇关于在圆中找到弦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文