close
Skip to content

bug fix: float precision overflow in IM_NORMALIZE2F_OVER_ZERO - #6331

Open
InJoins wants to merge 1 commit into
ocornut:masterfrom
InJoins:master
Open

bug fix: float precision overflow in IM_NORMALIZE2F_OVER_ZERO#6331
InJoins wants to merge 1 commit into
ocornut:masterfrom
InJoins:master

Conversation

@InJoins

@InJoins InJoins commented Apr 14, 2023

Copy link
Copy Markdown

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

InJoins commented Apr 14, 2023

Copy link
Copy Markdown
Author

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

ocornut commented May 18, 2023

Copy link
Copy Markdown
Owner

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.

2 participants