beeman algorithm