Determine position of two points with respect to a 3D plane | Function to check position of two points with respect to a plane in 3D ; Put coordinates in plane equation ; If both values have same sign ; If both values have different sign ; If both values are zero ; If either of the two values is zero ; Driver Code ; Given Input ; Coordinates of points ; Function Call
def check_position ( a , b , c , d , x1 , y1 , z1 , x2 , y2 , z2 ) : NEW_LINE INDENT value_1 = a * x1 + b * y1 + c * z1 + d NEW_LINE value_2 = a * x2 + b * y2 + c * z2 + d NEW_LINE if ( ( value_1 > 0 and value_2 > 0 ) or ( value_1 < 0 and value_2 < 0 ) ) : NEW_LINE INDENT print ( " On ▁ same ▁ side " ) NEW_LINE DEDENT if ( ( value_1 > 0 and value_2 < 0 ) or ( value_1 < 0 and value_2 > 0 ) ) : NEW_LINE INDENT print ( " On ▁ different ▁ sides " ) NEW_LINE DEDENT if ( value_1 == 0 and value_2 == 0 ) : NEW_LINE INDENT print ( " Both ▁ on ▁ the ▁ plane " ) NEW_LINE DEDENT if ( value_1 == 0 and value_2 != 0 ) : NEW_LINE INDENT print ( " Point ▁ 1 ▁ on ▁ the ▁ plane " ) NEW_LINE DEDENT if ( value_1 != 0 and value_2 == 0 ) : NEW_LINE INDENT print ( " Point ▁ 2 ▁ on ▁ the ▁ plane " ) NEW_LINE DEDENT DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a , b , c , d = 1 , 2 , 3 , 4 NEW_LINE x1 , y1 , z1 = - 2 , - 2 , 1 NEW_LINE x2 , y2 , z2 = - 4 , 11 , - 1 NEW_LINE check_position ( a , b , c , d , x1 , y1 , z1 , x2 , y2 , z2 ) NEW_LINE DEDENT