Why is human euthanasia illegal?

We put dogs down when their quality of life is low. Why can’t we do the same with humans? Why is it considered more “humane” to keep a human alive when they have lost all bodily functions and can’t walk, eat, even communicate? I would bet that most people would be open to signing something stating they would rather go this way than a slow and painful death.