Does it make sense to rewrite some of this function using [Cartesian3](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/Cartesian3.js)?  For example, this is `Cartesian3.magnitude` and below is `Cartesian3.multiplyByScalar` (I'd use `1.0 / gamma`).

Up to you; makes little difference to me.  This current version is probably a tad faster.