Douglas algorithm