Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Wednesday, May 8, 2013

Midpoint


Problem: Compute the mid-point of two 2-dimensional points.

Solution in Python:

def compute_midpoint(x1, y1, x2, y2):
    """
    Author: Mayur P Srivastava
    """

    return (x1 + x2) / 2.0, (y1 + y2) / 2.0

Concepts Learned: Maths

No comments:

Post a Comment