SFML community forums

Help => Graphics => Topic started by: Tank on October 13, 2009, 01:29:56 pm

Title: Logical error with sf::Rect<T>?
Post by: Tank on October 13, 2009, 01:29:56 pm
Hey,

I'm just wondering about a behaviour inside the sf::Rect<T> class:

The method Contains() checks if a point is inside the rectangle, boundaries inclusive. But GetSize() returns a size without the right and bottom boundary.

So when I've got a rectangle from (0, 0) to (2, 2), then the points (x, y) are within that rect when x = [0, 2] and y = [0, 2]. Therefore I'm able to check for 3(!) points on each axis which means that the rectangle's width and/or height must be 3.

But since you return Right - Left (Bottom - Top) in GetSize(), I get a 2 here which leads to serious errors in my quadtree implementation. ;)
Title: Logical error with sf::Rect<T>?
Post by: Laurent on October 13, 2009, 01:51:41 pm
True :)

I'll fix it for SFML 2.
Title: Logical error with sf::Rect<T>?
Post by: Tank on October 13, 2009, 01:52:43 pm
Thanks. :)