When one is presented with an issue of a police shooting, one should ask themselves whether the perpetrator, for whatever they did, deserved to die for that. The answer is usually no. This was a dumb thing to do, but did he deserve to die for it? Probably not.
That's not what the police are there to determine. They're there to determine how to keep the public safe.
In this case, they had a clear view of him pointing what looked very much like a gun at passer-bys.
But it wasn't an actual gun. Shouldn't they determine that before doing something as egregious as shooting him to death? Arrest him if you need to. That's fine. An officer should take whatever precautions they need to but it still seems impulsive to shoot him to death.