You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm curious if Rect should be constrained to have the same guarantees as BoundBox where p0 is the (x, y) values closest to negative infinity, and p1 is the (x ,y) values closest to positive infinity, then obviating the need for the BoundBox type which is essentially just a Rect which results in code duplication.
In that scenario would it then also make sense to define Rect as follows?
Something that I found to be a bit of a footgun with BoundBox is that 'empty, otherwise invalid [BoundBox]' is defined to have the value Int::MAX for p0, and Int::MIN for p1. Would it be better to define BoundBox as an enum sum type (like std::Option) as follows:
pubenumBoundBox{Valid(Rect),Invalid}
Would this add too much overhead to what the BoundBox type is intended for? Does the user need to check the validity of the BoundBox regardless?
The text was updated successfully, but these errors were encountered:
Totally agree the the BoundBox change is much better than what's in there now.
I'm less opinionated on the Rect representation. For some other shapes, e.g. a many-sided polygon, it's often actually nicer to store an offset "externally". The most common cell-instance transformation - translations - becomes a single-point move. In such a setup Rect would just become something like width, height or dx, dy.
You want to roll in at least the anti-foot-gunning?
Rect
andBoundBox
I'm curious if
Rect
should be constrained to have the same guarantees asBoundBox
wherep0
is the (x, y) values closest to negative infinity, andp1
is the (x ,y) values closest to positive infinity, then obviating the need for theBoundBox
type which is essentially just aRect
which results in code duplication.In that scenario would it then also make sense to define
Rect
as follows?Perceived
BoundBox
footgunSomething that I found to be a bit of a footgun with
BoundBox
is that 'empty, otherwise invalid [BoundBox]' is defined to have the valueInt::MAX
forp0
, andInt::MIN
forp1
. Would it be better to defineBoundBox
as an enum sum type (like std::Option) as follows:Would this add too much overhead to what the
BoundBox
type is intended for? Does the user need to check the validity of theBoundBox
regardless?The text was updated successfully, but these errors were encountered: