Created MathUtils::midpoint function