Mollweide Pojection

Mollweide Pojection

The projection trades accuracy of angle and shape for accuracy of proportions in area, and as such is used where that property is needed, such as maps depicting global distributions.

The projection has the aspect ratio of 2:1.

Lat+Lng to Mollweide coordinates #

Given latitude mollweide_pojection_d3358117f72b81086a355ac20d0407ba10203b90.svg and longitude mollweide_pojection_c4e54388a7127a5e3b894ea7ec1b992199ad4ee2.svg as well as the meridian longitude mollweide_pojection_8a28e0d2f4764b1fdc7d7b0719ac9bdd86d53a31.svg (which will be in the center of the projection), the auxilary angle mollweide_pojection_0dd984b3c17df1a79975e491d01fb734faac15d9.svg is defined as:

mollweide_pojection_833241ed06d3df20e6ead2b597ae18deb5f6d6ff.svg

Using it we can define the uv coordinates mollweide_pojection_e0f495f457897392424e9b798d56bfa6ef3dc7c1.svg and mollweide_pojection_6591bb726acce7a3271d619daceaac977eb2444f.svg, where mollweide_pojection_676096153526867e06e659414a594511a8c0473f.svg is the radius of the globe to be projected. The formular is set up such that the resulting area is the same as the surface of the projecting globe.

mollweide_pojection_098504423aa1331d4395be84d2d9d940ebaba24b.svg

If we only only care about uv coordinates mollweide_pojection_2fded59a69c41e778b787f83bfb6094e9beceed8.svg and mollweide_pojection_9a1a2ac65dd0b185232dc5b0632635d7336de5d2.svg, the formular gets simpler.

mollweide_pojection_f9bbd0ceda4d6cba5b5895752c8bf2422d2b7cd2.svg

Finding mollweide_pojection_0dd984b3c17df1a79975e491d01fb734faac15d9.svg numerically #

mollweide_pojection_0dd984b3c17df1a79975e491d01fb734faac15d9.svg can be found by iterating the following equations.

mollweide_pojection_2bd4507518db524e85b6ae783ff8394e8abe48ca.svg

Mollweide coordinates to Lat+Lng #

For given uv coordinates mollweide_pojection_4c331405047e31fa129009cf7a41fc1688f2f613.svg and mollweide_pojection_f5070d542b71a98d2a255b7b0292f9fff1c832ff.svg one can find the latitude mollweide_pojection_d3358117f72b81086a355ac20d0407ba10203b90.svg and longitude mollweide_pojection_c4e54388a7127a5e3b894ea7ec1b992199ad4ee2.svg as follows:

mollweide_pojection_0251426cd4044158715d215cf317065f29ffcdd2.svg

In Code #

void lat_lng_to_mollweide(f32 phi, f32 lambda, f32* out_x, f32* out_y) {
    f32 theta = phi;
    f32 old_t;
    do {
        old_t = theta;
        f32 denom = cosf(theta);

        theta = theta - (2*theta + sin(2*theta) - pi*sin(phi)) /
                        (4 * denom * denom);

    } while(fabs(old_t - theta) > 0.001f);

    *out_x = lambda * cosf(theta) / pi; // [-1;     1]
    *out_y = sinf(theta) / 2;           // [-0.5; 0.5]
}

void mollweide_to_lat_lng(f32 x, f32 y, f32* out_phi, f32* out_lambda) {
    f32 sqrt_2   = sqrtf(2.0f);
    f32 theta    = asinf(y/sqrt_2);
    *out_phi     = asinf((2.0f*theta + sin(2.0f*theta))/pi);
    *out_lambda  = (x*pi)/(2.0f*sqrt_2*cos(theta));
}
Calendar October 22, 2023