Equation of a straight line with perpendicular distance D from origin and an angle A between the perpendicular from origin and x | Python3 program for the approach ; Function to find equation of a line whose distance from origin and angle made by the perpendicular from origin with x - axis is given ; Convert angle from degree to radian ; Handle the special case ; Calculate the sin and cos of angle ; Print the equation of the line ; Given Input ; Function Call
import math NEW_LINE def findLine ( distance , degree ) : NEW_LINE INDENT x = degree * 3.14159 / 180 NEW_LINE if ( degree > 90 ) : NEW_LINE INDENT print ( " Not ▁ Possible " ) NEW_LINE return NEW_LINE DEDENT result_1 = math . sin ( x ) NEW_LINE result_2 = math . cos ( x ) NEW_LINE print ( ' % .2f ' % result_2 , " x ▁ + " , ' % .2f ' % result_1 , " y ▁ = ▁ " , distance , sep = " " ) NEW_LINE DEDENT D = 10 NEW_LINE A = 30 NEW_LINE findLine ( D , A ) NEW_LINE