Reputation: 16398
Giving this sketch:
Is it possible to find any tangent point (The blue ones) giving that you know:
start angle
point in CW direction).Thanks.
Upvotes: 3
Views: 1886
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