On Wed, Jun 29, 2022 at 9:06 AM Chris Sherlock <chris.sherloc...@gmail.com> wrote:
> > On Mon, Jun 27, 2022 at 4:52 PM Miklos Vajna <vmik...@collabora.com> > wrote: > >> Hi Chris, >> >> On Mon, Jun 13, 2022 at 01:03:30PM +1000, Chris Sherlock < >> chris.sherloc...@gmail.com> wrote: >> > LibreOffice has seperate implementations for points, lines, rectangle, >> polygons and polypolygons - one is in the tools module, and the other is in >> the basegfx module. >> > >> > Are there any plans for deprecating the usage of the tools geometry >> primitives? I understand it will be needed for deserialising some legacy >> svm files, but is the intention to ever start replacing the tools >> primitives with the basegfx primitives? >> >> The trouble with e.g. tools::Rectangle is that it can have both a closed >> or a half-open interval, and you need to read the surrounding code to >> understand which mode is in use. basegfx::B2IRange is explicitly closed. >> >> So it would help readability to go with basegfx::B2IRange everywhere, >> but it's not an easy hack to do such conversions. >> >> Regards, >> >> Miklos >> > > Thanks Miklos. I read the comment above the Rectangle header definition > which starts with "Note: this class is a true marvel of engineering: > because the author could not decide whether it's better to have a closed or > half-open interval, they just implemented *both* in the same class!" > > What is the feasibility of changing this class to be only explicitly > closed? > > Is this the main issue with not converting over to basegfx? > > Chris > A quick followup - I have changed the getWidth() and getHeight() functions in tools::Rectangle to getHalfOpenWidth/getHalfOpenHeight() - it seems needlessly confusing to have functions with the same name except capitalizing the first letter (!!) and have differing functionality. The gerrit commit is here: https://gerrit.libreoffice.org/c/core/+/136575 Is this reasonable? Chris