• Create Account

Banner advertising on our site currently available from just \$5!

Posted 28 August 2013 - 08:46 AM

let c = (cx, cy) EDIT: That's the centre of the circle, should have mentioned that huh? lol

let touch point p = (px, py)

vector from c to p = p - c = (px - cx, py - cy), call this r.

intersect point = c + normalize( r ) * radius

You can also use trig, the angle in radians from the centre is atan2(ry, rx) but then you have to use trig again to find intersect point = (cx + radius * cos(angle), cy + radius * sin(angle)).

I'm guessing the mathworld link is for the generic case of line-circle intersection (i.e. line doesn't have to go through the centre so there are 0, 1 or 2 solutions).

Posted 28 August 2013 - 08:28 AM

let c = (cx, cy)

let touch point p = (px, py)

vector from c to p = p - c = (px - cx, py - cy), call this r.

intersect point = c + normalize( r ) * radius

You can also use trig, the angle in radians from the centre is atan2(ry, rx) but then you have to use trig again to find intersect point = (cx + radius * cos(angle), cy + radius * sin(angle)).

I'm guessing the mathworld link is for the generic case of line-circle intersection (i.e. line doesn't have to go through the centre so there are 0, 1 or 2 solutions).

Posted 28 August 2013 - 08:28 AM

let c = (cx, cy)

let touch point p = (px, py)

vector from c to p = p - c = (px - cx, py - cy), call this r.

intersect point = c + normalize® * radius

You can also use trig, the angle in radians from the centre is atan2(ry, rx) but then you have to use trig again to find intersect point = (cx + radius * cos(angle), cy + radius * sin(angle)).

I'm guessing the mathworld link is for the generic case of line-circle intersection (i.e. line doesn't have to go through the centre so there are 0, 1 or 2 solutions).

PARTNERS