RFC: Sane rectangle class
thb at libreoffice.org
Fri Mar 20 21:02:31 UTC 2020
Hi Regina, *,
Regina Henschel wrote:
> These off-by-one problems occur earlier than in VCL. For example
> changes to maSnapRect when a shape is transformed by shear and
Yep. Also c.f. SwRect mentioned earlier.
> A new kind of rectangle does not solve the problem, that you have to
> examine each use, whether including or excluding the edge is
> better. I think, only switching to double and using it a long as
> possible would really help to reduce off-by-one problems and
> increase accuracy.
There's still the half-open vs. closed interval difference, that is
orthogonal to the underlying value type.
Half-open is the natural definition for everything that gets
'rendered', as it matches semantics of polygon/triangle fill
Closed intervals seems to be more 'natural' as a concept - you stick
two points into that interval, and both will yield 'true' when you ask
the range then whether those two points are inside..
You can map either of those to both floating point and integer value
types; for basegfx currently, interestingly B2DRange (which uses
doubles) uses closed interval semantics.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1032 bytes
Desc: not available
More information about the LibreOffice