Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualParadigm Shifter

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).


#2Paradigm Shifter

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).


#1Paradigm Shifter

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