Equirectangular mapping_v0.2 - FoxelSA/libgnomonic GitHub Wiki
Overview
This page gives the frame in which equirectangular mappings are interpreted in the three dimension according to the manifold it maps, usually a sphere. It also explains the relationship that links equirectangular mappings and the rectilinear mappings obtained through implemented gnomonic projection algorithms.
Equirectangular mapping
Considering the mapped sphere by an equirectangular mapping, the following image illustrates how the frame is set according to this sphere :
The equirectangular mapping of the sphere is provided through a bitmap structure that should have twice the amount of pixels in the horizontal direction (width) rather than in the elevation direction (height). Considering the mapping frame, the extremity of the three dimensional frame x vector is located at mid height and contained in the first pixels column (left). The y vector extremity is also located at mid height but contained in the pixels column at the third quarter (left) of the mapping horizon. The z vector extremity, formally, is the top pixels line of the mapping.
Rectilinear mapping
The rectilinear plane on which rectilinear mappings are built is always located as illustrated on the previous image, in yellow. The focal length defines the distance to the origin of the mapped sphere and the intersection between x direction and the rectilinear plane always defines the center of the gnomonic projection.
The size of the recilinear image is set using its size in pixels and the pixels size, assumed to be the same on both directions. Pixel size and focal length are waited in millimeters by the implemented algorithms.
In order to select the desired part of the equirectangular mapping that is projected on the rectilinear plane, three rotation matrices are considered defined by the azimuth, the elevation and the roll angles. Considering a pixel in the rectilinear plane (x,y,z), part of the desired rectilinear image, the corresponding point of the equirectangular mapping is obtained using the transformation :
(X,Y) = T(Ry(elevation, Rz(azimuth, Rx(roll, P(x,y,z)))))
where (X,Y) are the pixel coordinates on the equirectangular mapping. The P projection brings the point on the sphere along its radius. The Rx rotates the obtained point of the sphere around the x vector with angle roll. The Rz and Ry do the same according to z and y and azimuth and elevation angles, respectively. The T operator simply convert the angular position of the resulting point in equirectangular mapping pixel coordinates.