Skip to content

struct Rect: bool IsEmpty() const { return bottom <= top || right <= left; }; #437

@geotyper

Description

@geotyper

In struct rRect:
Rect() :
left(0),
top(0),
right(0),
bottom(0) {}
top is top coordinate, so it need be bigger than bottom coordinate, only if we not in screen coordinates, where axis y is reversal to normal axis y.
All work, but need to swap in Rect init bottom and top coordinates.
Thanks for attention.

Post remark:
I found in closed issues your comment:
Well that depends on your graphics display. In Cartesian coordinates you're absolutely correct. But in many graphics display libraries, including those I've used in developing this library, they invert the Y axis so that values increasing from 0 as you move DOWN the Y axis. In other words, rather than the origin (0,0) being bottom left, the origin is top left.

But I think it need to add some words about that on your site in Coordinate Range.
Because it not often use reverse y in 2d engines and libs.
Or add some small functions or flags that invert y Axis, but also need to now screen size minimum by axis y.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions