vurtun / nuklear

A single-header ANSI C gui library
13.68k stars 1.11k forks source link

Fixing the nk_cos function. #900

Closed molecularentropy closed 5 years ago

molecularentropy commented 5 years ago

Drawing a circle, with config.circle_segment_count set to 22, one can see a small kink in the rightmost part of the circle. Increasing the segment count to 220, we see this: Screenshot_2019-09-10_18-37-08 It seems that the nk_cos implementation is actually really off. I have regenerated the approximation series with lolremez. Now, with the fixed nk_cos implementation we get: Screenshot_2019-09-10_18-48-24 Please consider for inclusion.

dumblob commented 5 years ago

Yep, nk_cos was always meant only for nuklear internal use for low number of pixels. But I see, that this small change which shall have rather small impact on performance makes a significant difference, so I'm definitely merging it :wink:.

Thanks for tracking this down and for the pull!