[PROJ] intersects function

Javier Jimenez Shaw j1 at jimenezshaw.com
Sat Jun 8 12:33:56 PDT 2024


Hi

I am having a look at
bool GeographicBoundingBox::Private::intersects(const Private &other) const
{
(at metadata.cpp
https://github.com/OSGeo/PROJ/blob/e0e14829a404672adcf494057d7d70cfc8f96905/src/iso19111/metadata.cpp#L315
)

And I see something estrange

The function starts with 3 if statements:

    if (N < oS || S > oN) {
        return false;
    }

    if (W == -180.0 && E == 180.0 && oW > oE) {
        return true;
    }

    if (oW == -180.0 && oE == 180.0 && W > E) {
        return true;
    }

The first is clear: checks the intersection in the N-S range.
But the second and third I would expect
    if (W == -180.0 && E == 180.0) {
        return true;
    }

    if (oW == -180.0 && oE == 180.0) {
        return true;
    }
if it covers the whole planet (from -180 to 180) it clearly intersects,
right? Or am I missing something? (after is passes the first if statement
on N-S)

I am not trying to optimize the method, but just to understand it (I am
implementing it in javascript)

Thanks.


.___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20240608/b02c5605/attachment.htm>


More information about the PROJ mailing list