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

Incorrect calculation of points in angled "via" option #256

Open
amshikov opened this issue Jan 15, 2021 · 6 comments
Open

Incorrect calculation of points in angled "via" option #256

amshikov opened this issue Jan 15, 2021 · 6 comments

Comments

@amshikov
Copy link

Hello!

Simple configuration of two nodes and link angled via one point produces broken link between nodes:

NODE sw2-vg
        LABEL sw2-vg.ki
        ICON images/core-switch-blue.png
        POSITION 1800 190

NODE swc1-mrp
        LABEL swc1-mrp.dn
        ICON 100 100 images/core-switch-blue.png
        POSITION 4300 2448

# regular LINKs:
LINK sw2-vg-swc1-mrp
        NODES sw2-vg:170:170 swc1-mrp
        VIA 4300 360
        VIASTYLE angled

The lengths of parts of such link are wrongly calculated. Example screenshot: https://puu.sh/H7dPD/f7296b0d00.pngn
Could you please take a look? Thank you.

@howardjones
Copy link
Owner

howardjones commented Jan 15, 2021

This sounds like #205 (especially with a large map like you have)

You didn't say what version you have, but give this a try assuming it's 0.98/0.98a:

in lib/WeatherMap.functions.php, around line 1330 is the simplify_spline function. Decrease the epsilon value there from 1e-8 to 1e-11. This is the largest area of a triangle that weathermap considers to be a straight line - when you have such a long line, a small deviation (from rounding errors) makes it not as sensitive as it should be, and that causes other problems with link drawing, which assumes that points next to each other are not in a line. Geometry for VIAs is complicated! :-)

@amshikov
Copy link
Author

I apologise for not mentioning a version. I indeed have 0.98a. I've found this function, decreased a value, but it didn't help. It seems that changing that value has not effect et-all, at least in editor. Does editor use the same library?

@howardjones
Copy link
Owner

Yes, it should. I'll try to reproduce this over the weekend from your config above and let you know what I find.

@howardjones
Copy link
Owner

howardjones commented Jan 16, 2021

Just notes for myself... The original spine for the link shows the expected path. The path is simplified during draw_straight() and loses the corner. Also there are no points between the splitpos and the VIA. Changing SPLITPOS to 47 is enough to get a proper corner again. We need to detect when the corner doesn't have any intermediate points, and add one.

image

@amshikov
Copy link
Author

Dear Howard,
thank you for workaround provided!

@howardjones
Copy link
Owner

No problem! I'm still working on the right way to fix it - there's a lot going on to draw one of these angled links :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants