Original Post
Hi all,
More than just solving this problem I'd love if someone could explain to me the cause for this:
I'm doing a winforms projects and have a picture box with an image. I drag a rectangle over that image and get the bounds of that rectangle. The thing is that I need to store these bounds as UV coordinates and as the picture box Y is at the top and UV's Y(or V) starts at bottom I need to flip them. I do this like so :
return new RectangleF(bounds.X, 1.0f - (bounds.Height + bounds.Y), bounds.Width, bounds.Height);
I should mention that X and Y range from 0.0000 - 1.0000.
Now the problem occurs when I select most if not all the box and the equations looks something like:
return new RectangleF(bounds.X, 1.0f - (0.9886 + 0.0114), bounds.Width, bounds.Height);
Now obviously 1.0f minus this sum should make 0, but instead I'm getting -0.0000000158324838.
Now I've seen that a float has a 7point accuracy but as you can see I'm not using that, so what is the problem?
Any help would be much appreciated.
More than just solving this problem I'd love if someone could explain to me the cause for this:
I'm doing a winforms projects and have a picture box with an image. I drag a rectangle over that image and get the bounds of that rectangle. The thing is that I need to store these bounds as UV coordinates and as the picture box Y is at the top and UV's Y(or V) starts at bottom I need to flip them. I do this like so :
return new RectangleF(bounds.X, 1.0f - (bounds.Height + bounds.Y), bounds.Width, bounds.Height);
I should mention that X and Y range from 0.0000 - 1.0000.
Now the problem occurs when I select most if not all the box and the equations looks something like:
return new RectangleF(bounds.X, 1.0f - (0.9886 + 0.0114), bounds.Width, bounds.Height);
Now obviously 1.0f minus this sum should make 0, but instead I'm getting -0.0000000158324838.
Now I've seen that a float has a 7point accuracy but as you can see I'm not using that, so what is the problem?
Any help would be much appreciated.