raytraverse.translate¶
functions for translating between coordinate spaces and resolutions
-
raytraverse.translate.
uv2xy
(uv)[source]¶ translate from unit square (0,1),(0,1) to disk (x,y) http://psgraphics.blogspot.com/2011/01/improved-code-for-concentric -map.html.
-
raytraverse.translate.
uv2xyz
(uv, axes=0, 1, 2, xsign=- 1)[source]¶ translate from 2 x unit square (0,2),(0,1) to unit sphere (x,y,z) http://psgraphics.blogspot.com/2011/01/improved-code-for-concentric -map.html.
-
raytraverse.translate.
xyz2uv
(xyz, normalize=False, axes=0, 1, 2, flipu=True)[source]¶ translate from vector x,y,z (normalized) to u,v (0,2),(0,1) Shirley, Peter, and Kenneth Chiu. A Low Distortion Map Between Disk and Square. Journal of Graphics Tools, vol. 2, no. 3, Jan. 1997, pp. 45-52. Taylor and Francis+NEJM, doi:10.1080/10867651.1997.10487479.
-
raytraverse.translate.
tp2xyz
(thetaphi, normalize=True)[source]¶ calculate x,y,z vector from theta (0-pi) and phi (0-2pi) RHS Z-up
-
raytraverse.translate.
resample
(samps, ts=None, gauss=True, radius=None)[source]¶ simple array resampling. requires whole number multiple scaling.
- Parameters
samps (np.array) – array to resample along each axis
ts (tuple, optional) – shape of output array, should be multiple of samps.shape
gauss (bool, optional) – apply gaussian filter to upsampling
radius (float, optional) – when gauss is True, filter radius, default is the scale ratio - 1
- Returns
to resampled array
- Return type
np.array
-
raytraverse.translate.
rmtx_yp
(v)[source]¶ generate a pair of rotation matrices to transform from vector v to z, enforcing a z-up in the source space and a y-up in the destination. If v is z, returns pair of identity matrices, if v is -z returns pair of 180 degree rotation matrices.
- Parameters
v (array-like of size (3,)) – the vector direction representing the starting coordinate space
- Returns
ymtx, pmtx – two rotation matrices to be premultiplied in order to reverse transorm, swap order and transpose. Forward: pmtx@(ymtx@xyz.T)).T Backward: ymtx.T@(pmtx.T@xyz.T)).T
- Return type
(np.array, np.array)
-
raytraverse.translate.
chord2theta
(c)[source]¶ compute angle from chord on unit circle
- Parameters
c (float) – chord or euclidean distance between normalized direction vectors
- Returns
theta – angle captured by chord
- Return type
float