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

bug fix: float precision overflow in IM_NORMALIZE2F_OVER_ZERO #6331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

InJoins
Copy link

@InJoins InJoins commented Apr 14, 2023

when added vertices are particularly dense or close together, sometimes the resulting lines will crack, flicker, or even cover the entire screen, causing the screen to flicker Since a root-splitting calculation will be performed later, 0.001 is appropriate

affected functions: AddPolyline, AddConvexPolyFilled

when added vertices are particularly dense or close together, sometimes the resulting lines will crack, flicker, or even cover the entire screen, causing the screen to flicker
Since a root-splitting calculation will be performed later, 0.001 is appropriate

affected functions: AddPolyline, AddConvexPolyFilled
@InJoins
Copy link
Author

InJoins commented Apr 14, 2023

Since the added points are in the unit of screen pixels, two consecutive points in a polyline with a distance of sqrt(0.001)=0.0316 pixels have no effect on the final accuracy and display effect as a single point.

@ocornut
Copy link
Owner

ocornut commented May 18, 2023

Hello,

Could you post repro of shapes that are noticeably affected?

If I try:

ImDrawList* draw_list = ImGui::GetForegroundDrawList();
draw_list->PathLineTo(ImVec2(100, 100));
draw_list->PathLineTo(ImVec2(200, 100));
draw_list->PathLineTo(ImVec2(200, 100.00001f));
draw_list->PathLineTo(ImVec2(100, 300.0f));
draw_list->PathStroke(IM_COL32_WHITE, 0, 3.0f);

Original code:
image

Yours:
image

I'd be interested to see how your case behave with #2964 because my case behave well with it (branch: https://github.com/ocornut/imgui/tree/features/potocpav-newer-lines-2)

Ref #4053, #3366 for similar change in the other macro.

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

Successfully merging this pull request may close these issues.

None yet

2 participants