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

AddTriangle draws lines with nonuniform thickness #2868

Closed
nem0 opened this issue Oct 24, 2019 · 3 comments
Closed

AddTriangle draws lines with nonuniform thickness #2868

nem0 opened this issue Oct 24, 2019 · 3 comments

Comments

@nem0
Copy link
Contributor

nem0 commented Oct 24, 2019

Version/Branch of Dear ImGui:

Version: 1.74 WIP (3c238ec latest commit at this time, but the same issue is even in much older versions)
Branch: master

Back-ends: imgui_impl_dx11.cpp + imgui_impl_win32.cpp
Compiler: msvc 2019
Operating System: Win10

My Issue/Question:

Lines of a triangle have nonuniform thickness

Screenshots/Video

image

Standalone, minimal, complete and verifiable example:

        ImGui::Begin("test");
        auto dl = ImGui::GetWindowDrawList();
        const ImVec2 o = ImGui::GetCursorScreenPos();

        dl->AddTriangle(o, ImVec2(o.x + 100, o.y + 0), ImVec2(o.x + 0, o.y + 100), IM_COL32(0, 255, 0, 255), 3);
        ImGui::End();

If I do this, the triangle looks allright:
image

@ocornut
Copy link
Owner

ocornut commented Oct 24, 2019

Hi !

I believe this is the same as #2183 in particular there's a suggestion #2183 (comment)
(the change referred in that comment is #2518 by @rmitton)

I haven't looked at your suggestion is detail, it seems simpler to implement than mentioned in the comment above (tho the sqrt is costly), I just have no idea if it is right.

We probably need a little portable suite that shows a bunch of test cases so we can compare algorithms.

Pasting actual text for your patch would help :)

@nem0
Copy link
Contributor Author

nem0 commented Oct 24, 2019

Oh yes, it is indeed the same issue. I'm sorry for that. I tried to search for something similar without success. My fix is probably not robust/complete, since I did not understand what IM_FIXNORMAL2F supposed to do and did not investigate further. I will try to improve the fix.
Closing this now and I will continue in #2183 if I think of anyhting.

@ocornut
Copy link
Owner

ocornut commented Apr 19, 2021

There was actually an issue which creeped in January 2019 and made this worst>
See #4053, fix pushed.

ocornut added a commit that referenced this issue Apr 19, 2021
…ioritize preserving property of limiting extents. (#4053, #3366, #2964, #2868, #2518, #2183)

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

No branches or pull requests

2 participants