# Uniform distortion

Back to PastelMath

A uniform distortion is a continuous function which distorts ${\left[0 , 1\right]}^{n} \subset {\mathbb{R}}^{n}$ to another point-set $V \subset {\mathbb{R}}^{n}$ such that if there is a uniform distribution on ${\left[0 , 1\right]}^{n}$ then the function maps it to a uniform distribution on $V$ .

## Practice

Pastel implements the following distortions between regions of uniform distributions:

• ${\left[0 , 1\right]}^{n} \leftrightarrow$ simplex in ${\mathbb{R}}^{n}$
• ${\left[0 , 1\right]}^{n - 1} \leftrightarrow$ sphere (surface) in ${\mathbb{R}}^{1}$, ${\mathbb{R}}^{2}$, and ${\mathbb{R}}^{3}$
• ${\left[0 , 1\right]}^{n} \leftrightarrow$ ball in ${\mathbb{R}}^{1}$, ${\mathbb{R}}^{2}$, and ${\mathbb{R}}^{3}$
• ${\left[0 , 1\right]}^{n} \leftrightarrow$ annulus in ${\mathbb{R}}^{1}$, ${\mathbb{R}}^{2}$, and ${\mathbb{R}}^{3}$
• ${\left[0 , 1\right]}^{n - 1} \leftrightarrow$ hemisphere (surface) in ${\mathbb{R}}^{1}$, ${\mathbb{R}}^{2}$, and ${\mathbb{R}}^{3}$

Although not actually a distortion to a uniform sampling (we didn’t have a better place for the function), we also provide:

• ${\left[0 , 1\right]}^{n - 1} \leftrightarrow$ cosine-weighted distribution on hemisphere (surface) in ${\mathbb{R}}^{1}$, ${\mathbb{R}}^{2}$, and ${\mathbb{R}}^{3}$

This kind of uniform distribution distortion does not generalize easily to higher dimensions. To the best of our knowledge, none of the distortions listed above (except the simplex) have closed form solutions for n > 3.

If you simply need to generate random samples uniformly from $V$, then that is easier and can be done more generally using uniform sampling.

## References

Physically Based Rendering: From Theory to Implementation, Matt Pharr, Greg Humphreys, 2004.