Thread: Tips&Tricks in AVS View Single Post 8th April 2003, 11:12 #67 shreyas_potnis Major Dude   Join Date: Jan 2003 Location: Mumbai, India Posts: 787 Conversion of polar co-ords. into rectangular ones and vice-versa: to convert polar co-ords. into rectangular ones, use: x=sin(r)*d y=cos(r)*d to convert rectangular co-ords. into polar ones, use: d=sqrt(sqr(x)+sqr(y)) r=atan2(x,y) I hope I am right, correct me if I am not. I can explain, how d=sqrt(sqr(x)+sqr(y)) works. ```code: So, here's the deal: suppose x=.8 and y=.6, then the position of point point would be: y-axis ^ | |P Q |.6- - - - - - -.(.8,.6) | | | | |S |R x-axis <- - - - - - - - - - - - - - - - > |(0,0) .8 | | | | | | (this is an approximate figure) PQRS is the quadrilaeral formed. Now, we have to find l(SQ) or d(S,Q) I will solve this as we solve our geomtery problems, as this will give you a more clear idea. Given: 1) line x is perpendicaular to line y. 2) d(S,R)=.8 , d(P,S)=.6 3) seg PQ is perpendicular to line y & seg RQ is perpendicular to line x. to find: d(S,Q) i.e length of seg SQ. Construction: Draw seg SQ ( I could'nt draw it here ) . Sol'n: Statement |Reason 1) In, quad. PQRS, | m SQ = sqrt ( SR^2 + SQ^2 ) <=> SQ = sqrt ( .8^2 + .6^2 ) <=> SQ = sqrt ( .64 + .36 ) = sqrt ( 1.00 ) = 1 therefore SQ = 1 here, SQ = d so sqr ( d ) = sqr ( SR ) + sqr ( RQ ) = sqr ( X ) + sqr ( Y ) ( not the lines, but the position of the point ) <=> d = sqrt ( sqr ( X ) + sqr ( Y ) It would be nice if someone explained how r=atan2(x,y) works. ``` NOte: my first experiment without smiley's *I smile* http://home.iitb.ac*****~shreyaspotnis  