Sphere Mask

You can rebuild a cube equivalent with nodes this way:

For A/B vectors with 3 components change the setup to: http://abload.de/img/boxmask02gjs55.png