Coplanarity of Two Lines in 3D Geometry | Function to generate determinant ; Return the sum ; Driver Code ; Position vector of first line ; Direction ratios of line to which first line is parallel ; Position vectors of second line ; Direction ratios of line to which second line is parallel ; Determinant to check coplanarity ; If determinant is zero ; Otherwise
def det ( d ) : NEW_LINE INDENT Sum = d [ 0 ] [ 0 ] * ( ( d [ 1 ] [ 1 ] * d [ 2 ] [ 2 ] ) - ( d [ 2 ] [ 1 ] * d [ 1 ] [ 2 ] ) ) NEW_LINE Sum -= d [ 0 ] [ 1 ] * ( ( d [ 1 ] [ 0 ] * d [ 2 ] [ 2 ] ) - ( d [ 1 ] [ 2 ] * d [ 2 ] [ 0 ] ) ) NEW_LINE Sum += d [ 0 ] [ 2 ] * ( ( d [ 0 ] [ 1 ] * d [ 1 ] [ 2 ] ) - ( d [ 0 ] [ 2 ] * d [ 1 ] [ 1 ] ) ) NEW_LINE return Sum NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT x1 , y1 , z1 = - 3 , 1 , 5 NEW_LINE a1 , b1 , c1 = - 3 , 1 , 5 NEW_LINE x2 , y2 , z2 = - 1 , 2 , 5 NEW_LINE a2 , b2 , c2 = - 1 , 2 , 5 NEW_LINE det_list = [ [ x2 - x1 , y2 - y1 , z2 - z1 ] , [ a1 , b1 , c1 ] , [ a2 , b2 , c2 ] ] NEW_LINE if ( det ( det_list ) == 0 ) : NEW_LINE INDENT print ( " Lines ▁ are ▁ coplanar " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " Lines ▁ are ▁ non ▁ coplanar " ) NEW_LINE DEDENT DEDENT