Find if a point lies inside , outside or on the circumcircle of three points A , B , C | Function to find the line given two points ; Function which converts the input line to its perpendicular bisector . It also inputs the points whose mid - lies o on the bisector ; Find the mid point ; x coordinates ; y coordinates ; c = - bx + ay ; Assign the coefficient of a and b ; Returns the intersection of two lines ; Find determinant ; Returns the intersection of two lines ; Find determinant ; Function to find the point lies inside , outside or on the circle ; Store the coordinates radius of circumcircle ; Line PQ is represented as ax + by = c ; Line QR is represented as ex + fy = g ; Converting lines PQ and QR to perpendicular bisectors . After this , L = ax + by = c M = ex + fy = g ; The of intersection of L and M gives r as the circumcenter ; Length of radius ; Distance between radius and the given D ; Condition for lies inside circumcircle ; Condition for lies on circumcircle ; Condition for lies outside circumcircle ; Driver Code ; Given Points ; Function call to find the lies inside , outside or on the circle
def lineFromPoints ( P , Q , a , b , c ) : NEW_LINE INDENT a = Q [ 1 ] - P [ 1 ] NEW_LINE b = P [ 0 ] - Q [ 0 ] NEW_LINE c = a * ( P [ 0 ] ) + b * ( P [ 1 ] ) NEW_LINE return a , b , c NEW_LINE DEDENT def perpenBisectorFromLine ( P , Q , a , b , c ) : NEW_LINE INDENT mid_point = [ 0 , 0 ] NEW_LINE mid_point [ 0 ] = ( P [ 0 ] + Q [ 0 ] ) / 2 NEW_LINE mid_point [ 1 ] = ( P [ 1 ] + Q [ 1 ] ) / 2 NEW_LINE c = ( - b * ( mid_point [ 0 ] ) + a * ( mid_point [ 1 ] ) ) NEW_LINE temp = a NEW_LINE a = - b NEW_LINE b = temp NEW_LINE return a , b , c NEW_LINE DEDENT def LineInterX ( a1 , b1 , c1 , a2 , b2 , c2 ) : NEW_LINE INDENT determ = a1 * b2 - a2 * b1 NEW_LINE x = ( b2 * c1 - b1 * c2 ) NEW_LINE x /= determ NEW_LINE return x NEW_LINE DEDENT def LineInterY ( a1 , b1 , c1 , a2 , b2 , c2 ) : NEW_LINE INDENT determ = a1 * b2 - a2 * b1 NEW_LINE y = ( a1 * c2 - a2 * c1 ) NEW_LINE print ( y ) NEW_LINE y /= determ NEW_LINE return y NEW_LINE DEDENT def findPosition ( P , Q , R , D ) : NEW_LINE INDENT r = [ 0 , 0 ] NEW_LINE a , b , c = lineFromPoints ( P , Q , 0 , 0 , 0 ) NEW_LINE e , f , g = lineFromPoints ( Q , R , 0 , 0 , 0 ) NEW_LINE a , b , c = perpenBisectorFromLine ( P , Q , a , b , c ) NEW_LINE e , f , g = perpenBisectorFromLine ( Q , R , e , f , g ) NEW_LINE r [ 0 ] = LineInterX ( a , b , c , e , f , g ) NEW_LINE r [ 1 ] = LineInterY ( a , b , c , e , f , g ) NEW_LINE q = ( ( r [ 0 ] - P [ 0 ] ) * ( r [ 0 ] - P [ 0 ] ) + ( r [ 1 ] - P [ 1 ] ) * ( r [ 1 ] - P [ 1 ] ) ) NEW_LINE dis = ( ( r [ 0 ] - D [ 0 ] ) * ( r [ 0 ] - D [ 0 ] ) + ( r [ 1 ] - D [ 1 ] ) * ( r [ 1 ] - D [ 1 ] ) ) NEW_LINE if ( dis < q ) : NEW_LINE INDENT print ( " Point ▁ ( " , D [ 0 ] , " , " , D [ 1 ] , " ) ▁ is ▁ inside ▁ the ▁ circumcircle " ) NEW_LINE DEDENT elif ( dis == q ) : NEW_LINE INDENT print ( " Point ▁ ( " , D [ 0 ] , " , " , D [ 1 ] , " ) ▁ lies ▁ on ▁ the ▁ circumcircle " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Point ▁ ( " , D [ 0 ] , " , " , D [ 1 ] , " ) ▁ lies ▁ outside ▁ the ▁ circumcircle " ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT A = [ 2 , 8 ] NEW_LINE B = [ 2 , 1 ] NEW_LINE C = [ 4 , 5 ] NEW_LINE D = [ 3 , 0 ] NEW_LINE findPosition ( A , B , C , D ) NEW_LINE DEDENT