Add midpoint displacement code from hw