   Straight line intersecting circle with angle
  Hello!I have the following problem:Points A and B and the angle my is known and I want to get the coordinates from Point C.Here is my approach:When I combine g and k I get 2 values for the parameter t. one value is 0 and so I get point B. But when I put the other value of t into the equation g I get a point with a radius much higher than 1 and so this point cannot intersect the circle :(.As an example, I took B(phi,radius) = (109°,1)A(phi,radius) = (32°,1)my = 51°for t I get 0 and -45.6.When I put t=-45.6 into equation g I get phi: 250.74712 radius: 139.4929 which does not intersect k.Can someone help me, how to get C properly?Thank you,   
  I would actually choose a similar approach, but not exactly the same (see my choose of the track of the ray):The rayR(t) := B + t * dwith the unit length track[ cos my  sin my ]d := [ ] * ( A - B ) / || A - B ||[-sin my  cos my ]being the vector BA but normalized and rotated by my (the signs of sin are correct only if your y co-ordinate grows when going to the top, else they have to be negated; however, a my as illustrated has to be negative).Then inserting into the circle formulax^2 + y^2 - 1 = 0(as you've already stated) would yield in 2 values of t, one should be 0, the other could be inserted into R(t) to yield in C.EDIT: This requires A and B not being coincident, of course.EDIT2: Hmm. Actually there is no need for normalizing the ray's track, so you could runtime optimize the method a little bit.[Edited by - haegarr on December 8, 2005 5:54:12 AM];  thanks.I tried to implement your approach:// vector AB:double ABx = Bx - Ax;double ABy = By - Ay;// normalize:double ABx_normal = ABx / Math.sqrt(ABx*ABx + ABy*ABy);double ABy_normal = ABy / Math.sqrt(ABx*ABx + ABy*ABy);// calculate dd1 = Math.cos(my)*ABx_normal + Math.sin(my)*ABy_normal;d2 = -Math.sin(my)*ABx_normal + Math.cos(my)*ABy_normal;// -> [x,y] = [Bx,By] + t * [d1, d2]// -> x^2 + y^2 - 1 = 0// -> ([Bx] + t * [d1])^2 + ([By] + t * [d2])^2 - 1 = 0// -> t1, t2When I do this way, I also get wrong results.   ;  ups. it works. there was just a little error in my code.   ;  Fine ;-)However, you could try to use ABx and ABy directly instead of ABx_normal and ABy_normal. It should work as well (since t would be lesser by the same factor than d would be greater), but avoids computing sqrt and divisions, both operations with measureable runtime costs.   ;  just another question: how can I determin, whether the y coordinate of BC grows when going to the top?   ;Quote:Original post by dnaxxjust another question: how can I determin, whether the y coordinate of BC grows when going to the top?Sorry, I don't understand what the problem is.The sign of the y co-ordinate of BC, i.e. Cy-By, will be negative if running against the y axis of your co-ordinate system. It will be 0 if orthogonal, and positive if running with the axis. Do you mean that?;  I was refering to this:Quote:Original post by haegarrbeing the vector BA but normalized and rotated by my (the signs of sin are correct only if your y co-ordinate grows when going to the top, else they have to be negated; however, a my as illustrated has to be negative)....But I think I misunderstood you, because everything works fine now.   ;  Just for clarity: It is just a question of convention, namely how your co-ordinate system is defined: When rotating by a positive angle, is the x axis being rotated towards the positive or else the negative y axis?!If your illustrated example is ok with a _negative_ my then your y axis point upwards when the x axis points to the right. Is all ok.   