Skip to content

EMPTY rect has suboptimal values #13461

@alice-i-cecile

Description

@alice-i-cecile

The EMPTY rect should be one in which max is set to MIN and min is set to MAX. In other words, it's a rectangle of infinite negative size.

This is a common practice in many other geometry libraries. The reasoning is simple: an empty rectangle is often used when calculating the union of a series of rectangles (that is, the outer bounds of all of them.). The union of a finite rect A with a negative infinite rect B is just A. So we can start with an empty rect and successively union with each rectangle in turn, using a classic "reduce" or "fold" method.

Note that the EMPTY rect is not the same as a zero-size rect. The rect that is the result of too much negative inflation is not the same as EMPTY because it is still centered at the point of the original rect.

Originally posted by @viridia in #13452 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesX-UncontroversialThis work is generally agreed upon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions