human
What is a code to find if a point lies inside , outside or on the circumcircle of three points A , B , C and the other steps required given the following:
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"
Solution in Python:
assistant
#Here is code to find if a point lies inside , outside or on the circumcircle of three points A , B , C and the other steps required.
 def lineFromPoints ( P , Q , a , b , c ) :
	a = Q [ 1 ] - P [ 1 ]
	b = P [ 0 ] - Q [ 0 ]
	c = a * ( P [ 0 ] ) + b * ( P [ 1 ] )
	return a , b , c
def perpenBisectorFromLine ( P , Q , a , b , c ) :
	mid_point = [ 0 , 0 ]
	mid_point [ 0 ] = ( P [ 0 ] + Q [ 0 ] ) / 2
	mid_point [ 1 ] = ( P [ 1 ] + Q [ 1 ] ) / 2
	c = ( - b * ( mid_point [ 0 ] ) + a * ( mid_point [ 1 ] ) )
	temp = a
	a = - b
	b = temp
	return a , b , c
def LineInterX ( a1 , b1 , c1 , a2 , b2 , c2 ) :
	determ = a1 * b2 - a2 * b1
	x = ( b2 * c1 - b1 * c2 )
	x /= determ
	return x
def LineInterY ( a1 , b1 , c1 , a2 , b2 , c2 ) :
	determ = a1 * b2 - a2 * b1
	y = ( a1 * c2 - a2 * c1 )
	print ( y )
	y /= determ
	return y
def findPosition ( P , Q , R , D ) :
	r = [ 0 , 0 ]
	a , b , c = lineFromPoints ( P , Q , 0 , 0 , 0 )
	e , f , g = lineFromPoints ( Q , R , 0 , 0 , 0 )
	a , b , c = perpenBisectorFromLine ( P , Q , a , b , c )
	e , f , g = perpenBisectorFromLine ( Q , R , e , f , g )
	r [ 0 ] = LineInterX ( a , b , c , e , f , g )
	r [ 1 ] = LineInterY ( a , b , c , e , f , g )
	q = ( ( r [ 0 ] - P [ 0 ] ) * ( r [ 0 ] - P [ 0 ] ) + ( r [ 1 ] - P [ 1 ] ) * ( r [ 1 ] - P [ 1 ] ) )
	dis = ( ( r [ 0 ] - D [ 0 ] ) * ( r [ 0 ] - D [ 0 ] ) + ( r [ 1 ] - D [ 1 ] ) * ( r [ 1 ] - D [ 1 ] ) )
	if ( dis < q ) :
		print ( " Point ▁ ( " , D [ 0 ] , " , " , D [ 1 ] , " ) ▁ is ▁ inside ▁ the ▁ circumcircle " )
	elif ( dis == q ) :
		print ( " Point ▁ ( " , D [ 0 ] , " , " , D [ 1 ] , " ) ▁ lies ▁ on ▁ the ▁ circumcircle " )
	else :
		print ( " Point ▁ ( " , D [ 0 ] , " , " , D [ 1 ] , " ) ▁ lies ▁ outside ▁ the ▁ circumcircle " )
if __name__ == ' _ _ main _ _ ' :
	A = [ 2 , 8 ]
	B = [ 2 , 1 ]
	C = [ 4 , 5 ]
	D = [ 3 , 0 ]
	findPosition ( A , B , C , D )