Midpoint Algebras