On Mon, 23 Mar 2020 at 17:12, Luboš Luňák <l.lunak@collabora.com> wrote:
I see the problem not in tools::Rectangle itself, but in the fact, that
it uses integer and not double. Using double makes width = right - left
in all cases
and would solve accuracy problems in manipulating shapes.
It would be up to renderer to do a suitable conversion to integer.
I don't think using double magically solves everything. The same result
can
be obtained by defining 'width = right - left' with integers, and I think
I
can mis-count pixels as doubles just as well.
Correct. Using floating point for rendering trades one set of problems for
another set of problems.
It is very easy to apply a set of transformations on floating point that
accumulate error, resulting in
bad output. It is also becomes quite hard to determine if an object is
still in the same place after a set of transformations,
even if mathematically the set of transforms ===> identity.
This is why we have ::approxEqual appearing around the place, which doesn't
always work.
Floating point is a fine choice for certain kinds of last-stage rendering
inside the graphics card, and for other use-cases (like CAD), quite it is
unavoidable.
For the common case of rendering spreadsheets and text, integer
co-ordinates are better behaved.
Context
- Re: RFC: Sane rectangle class (continued)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.