Code Monkey home page Code Monkey logo

Comments (1)

mol3earth avatar mol3earth commented on June 2, 2024

hi @bangph,

I took at look at the code base, specifically the equation for the azimuthal distance.

This equation comes from Map Projections - A Working Manual", page 30, equation 5-4b and explicitly states that the equation will not work for points >180° apart.

The lacking functionality you are seeking is not a bug. It is due to the nature of the trigonometric functions.

I found a few work arounds.

Option 1

You can add points to the polygon to ensure it is drawn in the direction you want.

        var boundary = [];
        boundary.push(new WorldWind.Location(60, -180));
        boundary.push(new WorldWind.Location(60, -75));
        boundary.push(new WorldWind.Location(60, 30));
        boundary.push(new WorldWind.Location(-60, 30));
        boundary.push(new WorldWind.Location(-60, -75));
        boundary.push(new WorldWind.Location(-60, -180));

Option 2

You can simply plot two rectangles, and make the border transparent, so that they appear to be one.

the two sets of boundary coordinates,
ymin = -60; ymax = 60; x1min = -180; x1max = -75;
ymin = -60; ymax = 60; x2min = -75; x2max = 30;

and the transparent outline,
attributes.outlineColor = new WorldWind.Color(0, 0, 0, 0);

In either case you will not have a smooth line connecting the -180 and 30 edges, instead you will have a triangle cutout there, if you want only 4 edges on your polygon, you can plot two triangles. e.g.

        boundary.push(new WorldWind.Location(60, -180));
        boundary.push(new WorldWind.Location(60, -75));
        boundary.push(new WorldWind.Location(60, 30));

If you don't care about the straight connection, you can set the pathType variable of the SurfacePolgyon to 'Linear' or 'RHUMB_LINE' and the line will be smooth and curved about the 60° and -60° Latitudes.

Hopefully this helps you.

from webworldwind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.