Simplified midpoint algorithm