Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong y direction in HyperbolicInterpolator #98

Open
g0ro opened this issue Sep 29, 2021 · 3 comments
Open

Wrong y direction in HyperbolicInterpolator #98

g0ro opened this issue Sep 29, 2021 · 3 comments
Assignees
Labels

Comments

@g0ro
Copy link

g0ro commented Sep 29, 2021

double h1 = southWestHeight, h2 = southEastHeight, h3 = northWestHeight, h4 = northEastHeight;

If x is from west to east and y is from north to south, then (0,0) point should be at NW, not SW

@xfischer
Copy link
Member

Hi @g0ro, thanks for reporting this. Can you submit a test case for that ? Which data set did you use ?

@g0ro
Copy link
Author

g0ro commented Oct 1, 2021

It does not depend on a dataset.
HyperbolicInterpolator's y is just inversed compared to BilinearInterpolator. The later seems to be right.

To test it, we may get height values of corner points, they should be the same:


        private static void TestInterpolators()
        {
            var iplBl = new BilinearInterpolator();
            var iplHb = new HyperbolicInterpolator();

            for (var x = 0; x<=1; x++)
            {
                for (var y = 0; y <= 1; y++)
                {
                    var hBl = iplBl.Interpolate(1, 2, 3, 4, x, y);
                    var hHb = iplHb.Interpolate(1, 2, 3, 4, x, y);
                    Console.WriteLine($"x={x} y={y} hBl={hBl} hHb={hHb}");
                }

            }

        }

But the result is inverted:

x=0 y=0 hBl=3 hHb=1
x=0 y=1 hBl=1 hHb=3
x=1 y=0 hBl=4 hHb=2
x=1 y=1 hBl=2 hHb=4

@xfischer
Copy link
Member

xfischer commented Oct 1, 2021

OK thanks for pointing this out. Will fix it

@xfischer xfischer self-assigned this Oct 1, 2021
@xfischer xfischer added the bug label Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants