Given a Point P(x, y) find two points S1 and S2 such that S1, S2 lies on line joining origin and P and d(P, S1) = d(p, S2) = r, i.e two points that are at distance r from P.
How to get S1, S2 using minimum number of characters in C++ (CodeGolf). Codes snippets are welcome ..
Thanks in advance
s1=
(x-rcos(h),y-rsin(h))
wheretan(h)
=slope of line
joiningorigin
with the pointP(x,y)=y/x
s2=
(x+rcos(h),y+rsin(h))
cos(h)=1/(sqrt(1+tan^2(h)))
sin(h)=sqrt(tan^2(h)/(1+tan^2(h)))