View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Is there a better way to do this?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1Normalized  Members

Posted 15 January 2012 - 01:46 PM

I have been working on trying to get an implementation of reciprocal obstacle avoidance working.

I need to find the point tangent to a circle from the origin (0,0). I know how to do this using two circles kind of like the diagram below. I was planning to us the quadratic equation to find the two tangents points.
http://www.nvcc.edu/home/tstreilein/constructions/Circle/circle5.htm
I need both tangent points
I know
1: circle center
3: And that the tangent points must pass through the origin (0,0).
I have not used much trig in many years. Is there a better trigonometry based way? I know how to find the lengths of all sides and the interior angles. But not how to find the tangent points.

### #2Normalized  Members

Posted 15 January 2012 - 04:13 PM

Ok so I forgot that slope = tan(angle) . What way do you think is better trig or not ?

### #3jjd  Members

Posted 15 January 2012 - 08:38 PM

Hi Normalized,

Since the tangent is always perpendicular to the line through the center of the circle and the point where the tangent touches the circle, you're dealing with a right angled triangle where you know the hypotenuse (distance from the origin to the center of the circle) and one of the sides (the radius of the circle). So the line segment from the origin to the tangent point on the circle has a length of

L = sqrt(H^2 - R^2)

where H is the length of the line from the origin to the center of the circle and R is the radius of the circle. The angle between the tangent and the line from the origin to the center of the circle is

theta = asin(R/H)

So you can create a vector of length L that is parallel to line from the origin to the center of the circle, and rotate it by +/- theta to get the tangent points.

-Josh

--www.physicaluncertainty.com