SFML community forums

Help => Graphics => Topic started by: Redee on July 11, 2015, 03:14:43 pm

Title: Visual size of Square ??
Post by: Redee on July 11, 2015, 03:14:43 pm
If I create RectangleShape(10.5001f, 10.5001f) - see on monitor square with size of 11px width and 10px height.
Created RenderWindow with size 800x800.

Why not 11px / 11px square.
If I set 10.501f / 10.501f - got square 11 / 11.
But me need 4 signs precision after point.
Title: Re: Visual size of Square ??
Post by: eXpl0it3r on July 11, 2015, 03:18:41 pm
Because of OpenGL rasterisation.
Title: Re: Visual size of Square ??
Post by: Jesper Juhl on July 11, 2015, 03:26:58 pm
See also What Every Computer Scientist Should Know About Floating-Point Arithmetic (http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html)
Title: Re: Visual size of Square ??
Post by: Redee on July 11, 2015, 03:29:46 pm
Thats why need store 2 sizes of Object >>
1 - logic math
2 - whole number without signs after point to Display

Using f.e. >> floor(x + 0.5f);