简体   繁体   English

在Circle中找到tanget Point

[英]Find tanget Point in Circle

Giving this sketch: 给这个草图:

在此输入图像描述

Is it possible to find any tangent point (The blue ones) giving that you know: 有没有可能找到任何切点(蓝色的)给你知道:

  • The center point of the circle (width/2, width/2). 圆的中心点(宽度/ 2,宽度/ 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). 连接所述未知点到中心的线的度角 (角度从计算start angle在CW方向点)。

Thanks. 谢谢。

Yeah, it's definitely possible. 是的,这绝对是可能的。

The radius is width/2 . 半径是width/2

You know the angle, so do the trigonometry. 你知道角度,三角学也是如此。

Here is some code: 这是一些代码:

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;


EDIT 编辑

Since you only want positive values, you can do this with your already-calculated x and y . 由于您只需要正值,因此可以使用已经计算的xy来执行此操作。

x += radius;

y = radius - y;

A video on the unit circle: http://www.khanacademy.org/math/trigonometry/v/unit-circle-definition-of-trig-functions 关于单位圈的视频: http//www.khanacademy.org/math/trigonometry/v/unit-circle-definition-of-trig-functions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM