Section formula for 3 D | Function to find the section of the line ; Applying section formula ; Printing result ; Driver code
def section ( x1 , x2 , y1 , y2 , z1 , z2 , m , n ) : NEW_LINE INDENT x = ( ( m * x2 ) + ( n * x1 ) ) / ( m + n ) NEW_LINE y = ( ( m * y2 ) + ( n * y1 ) ) / ( m + n ) NEW_LINE z = ( ( m * z2 ) + ( n * z1 ) ) / ( m + n ) NEW_LINE print ( " ( " , x , " , " , y , " , " , z , " ) " ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT x1 = 2 NEW_LINE x2 = 4 NEW_LINE y1 = - 1 NEW_LINE y2 = 3 NEW_LINE z1 = 4 NEW_LINE z2 = 2 NEW_LINE m = 2 NEW_LINE n = 3 NEW_LINE section ( x1 , x2 , y1 , y2 , z1 , z2 , m , n ) NEW_LINE DEDENT