-
Notifications
You must be signed in to change notification settings - Fork 109
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
Geodesic preciseness #232
Comments
We have investigated this and found that the link actually consists of small peaces, each 5000 m lenght.
Alternatively we could try to use a different geodesic function, but we are yet not sure if it is really a different function (maths-wise) and if the communities would accept that change. If some Math-Superbrain could confirm that the two functions do the same it would be an option. |
As you can see our geodesic library is originally based on the same algorithm as arc.js (but implementation details may differ). Stock intel code is known to use another library: geodesy (there is also leaflet-friendly lib based on this: Leaflet.Geodesic). |
Its not about the geodesic function. Its about "how to draw a curved line".
no. maybe in your observation but the real rule is: divide a line into
what is "good"? the next bug report may tell you: "plz fix the 1m differenz" so, how to draw an curved line? For a better solution you've to recalculate every line depending on zoom level. |
Well, there are ready-to-use formulas, but.. it's still a huge work - to implement all this stuff efficiently. As for me - I do not have enough math background for such work. But I can implement customizable option for segment length, so everyone will have ability to set value that fits some particular conditions. I agree with @McBen, that it is far from ultimate solution, but in any case - it is better than what we have currently. But we'll leave this issue open, and wait for better alternatives. |
I suppose 'good' is close to stock intel. I'm not sure that we can reverse dashboard.js code, but we know what formulas it is based on. |
Each link has to be calculated from start to end, while only the visible part is displayed. The offset (in meters) is always the same. The interpolation done will only take care that start and end of the link hit the defined coords. The smaller the steps the less offset, but the more compute power used. So what do you think about reducing the divider to 500? |
I don't care about stock intel. I want a "correct" line. A line that nia-server will accept as "not crossing".
it's a shot into the dark. stealing performance from everybody and maybe help fixing your special problem.... no real solution |
@McBen when do you need the drawn line to be correct as long as crosslink is correct? |
At low zoom levels that offset will be less than 1 pixel. So no sense to spend CPU and memory.
Again: we do not care about offscreen precision, to better would be not calculate (and store) that unneeded points. |
And it is not a shot into dark, we have tested it. |
@MysticJay And precision is not free. Mobiles (and some desktops) may be short on resources. |
A way more complex problem is what happens if (in the above example) we not only have the A-C-link, but also plan about linking away from that middle portal (B), E.g. for a protective link. You would rather plan to the left. So yes, as a planner and operator I need a preciseness that will not lead me wrong. |
@Jormund here we're talking about visual correctness. And as we all know: iitc is wrong (in some cases)..like we know that the game-client itself sucks at this. @johnd0e "how does it handle all this?" In fact the current crosslink calculation was done by -good guy- Jon Atkins!. The difference: it's pure math instead of approximation. It can be solved with even more simpler math - high-school-level. I'll create a PR if I've got time. But as said, calculation and drawing are differnt jobs. |
Do you mean improved collision test algorithm that was commited in your fork? |
To summarize. I suppose we have to override There is also promising Anyway, even if we extend only |
|
@McBen It is draft PR, where we do not store intermediate points anymore.
But besides mentioned benefits there is also plenty space for future improvement:
|
@MysticJay custom-geodesic.user.js// ==UserScript==
// @id custom-geodesic
// @name IITC plugin: Custom geodesic
// @category Custom
// @version 0.1.0
// @description Customize geodesic precision by increasing intermediate points count
// @namespace https://github.com/IITC-CE/ingress-intel-total-conversion
// @include https://intel.ingress.com/*
// @grant none
// ==/UserScript==
if (typeof window.plugin !== 'function') window.plugin = function() {};
(function wrapper (plugin_info) {
function setup () {
L.GeodesicCircle.mergeOptions({ // default:
segmentsCoeff: 500, // 1000
segmentsMin: 96 // 48
});
var polyOptions = { segmentsCoeff: 500 }; // 5000
L.GeodesicPolyline.mergeOptions(polyOptions);
L.GeodesicPolygon.mergeOptions(polyOptions);
}
setup.priority = 'high';
setup.info = plugin_info; //add the script info data to the function as a property
if (!window.bootPlugins) window.bootPlugins = [];
window.bootPlugins.push(setup);
if (window.iitcLoaded && typeof setup === 'function') setup();
})({ script: typeof GM_info !== 'undefined' && GM_info.script && {
version: GM_info.script.version, name: GM_info.script.name, description: GM_info.script.description
}})// wrapper end |
Currently segments count calculation is based not on line length, but on longitude difference. Anyway, we can use distance formula:
And this fixes case with set of given 3 portals, even if we use far greater coefficient: |
The longer the segmentlenght the bigger is the offset, where curve and straight line between the nodes of the segmented poliline differ most (in the middle between nodes). Proposal 1: z<7 (lenght>10,000), segmentlenght=10,000 Implementing a table of fixed values for each zoom-level should do the job. Proposal 2: A simple if-statement could do the job. |
IMHO no real need. Crosslinks are only a few compared to the rest of the links. If everyone is fine with Jon's implementation, we should rather concentrate on other things. Put it on the Backlog in case CrossLinks-plugin needs other changes (like: crosslinks should also test if drawn links cross each other). |
My proposal:
Sidenote: crosslinks should detect on draws as well. |
Captured today at: https://intel.ingress.com/?pll=55.456331,9.951137 related links: |
Let me add some more details: a) top (post 1) example: b) example in #560 c) random long west-east link (from US to EU) d) random long north-south link (from sweden to africa) with with my test code; https://jsfiddle.net/mcben/rLcnug3w/16/ about arc.js: |
@McBen Thanks adding. 433m sounds really heavy, still I'd like to see, where that offset is visible. both ends of the line do not end on a portal. The max I was able to find on a close by link is 28m somewhere in the center. |
nah, my math is not fully correct. It skips map transformation and uses simple trigonometry to calculate the error-point. here is the code including visuals anyway, even 180m is quite far and 0.2meter is still a bug report. |
@McBen 0.2 m is nothing we are able to display. in the end it is about visualization. |
#560 even with |
This bug bubbles up every year: I would suggest to decrease
down to 1000 .
I'm (now) pretty sure modern system will handle well a little increase in line-drawing calls. |
I believe we should go back to johnd0e's suggestion: just take into account dLat, not just dLng. In fact, I believe I can PR it now! |
Suggested by @johnd0e in IITC-CE/ingress-intel-total-conversion#232 (comment). Should work for now, at least until we switch to the shinier Geodesic addon by henrythasler.
picking up an old issue, that already existed in legacy IITC:
iitc-project/ingress-intel-total-conversion#1011
The issue has not been resolved and can still be reproduced:
create a link from A to C and check the offset at location B
A: https://intel.ingress.com/intel?ll=55.477626,9.458853&z=17
B: https://intel.ingress.com/intel?ll=54.73925,9.439722&z=17
C: https://intel.ingress.com/intel?ll=53.785501,9.415725&z=17
The below picture shows
red line: stock Intel (manually added to the picture)
purple/pink line: IITC/IITC-CE
red dottet line: what Niantic reports back to be a blocker
The offset in the chosen example is about 12m (this value may vary in different locations all over the world). It seems always to be an east-west issue.
So while the drawn purple line does not touch the left links and these are indicated a crosslinks, the right link is not - even though the draw crosses it (a bit further up).
The text was updated successfully, but these errors were encountered: