eradiate.warp#

eradiate.warp.square_to_uniform_disk_concentric(sample)[source]#

Low-distortion concentric square to disk mapping.

Parameters:

sample (array-like) – A (N, 2) array of sample values.

Returns:

ndarray – Sampled coordinates on the unit disk as a (N, 2) array.

Notes

The function tries to be flexible with arrays with (N, 1) and (N,) arrays and attempts reshaping them to (N/2, 2). This, in particular, means that the following call will produce the expected result:

square_to_uniform_disk_concentric((0.5, 0.5))
eradiate.warp.square_to_uniform_hemisphere(sample)[source]#

Uniformly sample a vector on the unit hemisphere with respect to solid angles.

Parameters:

sample (array-like) – A (N, 2) array of sample values.

Returns:

ndarray – Sampled coordinates on the unit hemisphere as a (N, 3) array.

Notes

The function tries to be flexible with arrays with (N, 1) and (N,) arrays and attempts reshaping them to (N/2, 2). This, in particular, means that the following call will produce the expected result:

square_to_uniform_hemisphere((0.5, 0.5))
eradiate.warp.uniform_disk_to_square_concentric(p)[source]#

Inverse of the mapping square_to_uniform_disk_concentric.

Parameters:

p (array-like) – A (N, 2) array of vectors on the unit disk.

Returns:

ndarray – Corresponding coordinates on the [0, 1]² square as a (N, 2) array.

Notes

The function tries to be flexible with arrays with (N, 1) and (N,) arrays and attempts reshaping them to (N/2, 2). This, in particular, means that the following call will produce the expected result:

uniform_disk_to_square_concentric((0, 0))
eradiate.warp.uniform_hemisphere_to_square(v)[source]#

Inverse of the mapping square_to_uniform_hemisphere.

Parameters:

v (array-like) – A (N, 3) array of vectors on the unit sphere.

Returns:

ndarray – Corresponding coordinates on the [0, 1]² square as a (N, 2) array.

Notes

The function tries to be flexible with arrays with (N, 1) and (N,) arrays and attempts reshaping them to (N/3, 3). This, in particular, means that the following call will produce the expected result:

uniform_hemisphere_to_square((0, 0, 1))