iTurki
iTurki

Reputation: 16398

Find tanget Point in Circle

Giving this sketch:

enter image description here

Is it possible to find any tangent point (The blue ones) giving that you know:

Thanks.

Upvotes: 3

Views: 1886

Answers (1)

eboix
eboix

Reputation: 5133

Yeah, it's definitely possible.

The radius is 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.

x += radius;

y = radius - y;

A video on the unit circle: http://www.khanacademy.org/math/trigonometry/v/unit-circle-definition-of-trig-functions

Upvotes: 7

Related Questions