An assumedly okej SquarePyramid function in 3d.
Simplify some internal notation.
Tweak output.
Add a missing variable.