Volume preserving transformation between a cube and a ball (solid sphere)?

218 Views Asked by At

I have searched a lot online but I am unable to find such transformations, I only find difficult to read research papers and also this which is a nice mapping from cube to sphere but not with the restriction of volume.

My context may help. I have a set of RGB points, meaning points that lie on $[0-255, 0-255, 0-255]$ 3D space. This set of points forms a Cube in space. I want to map each $(r, g, b)$ to a new $(r', g', b')$ in a continuous manner. So, what I have thought, is to map the cube into a sphere, rotate the sphere around an axis, and then map back from sphere to cube. The reason I need this mapping, is because if I rotate directly on the cube, the new rgb point may fall out of the cube range. The sphere gives me the advantage of staying inside the boundaries.

The reason I need the volume preserving restriction, is that I want the "density" of each initial color to remain the same after the transformation.

Any help ?