[Units] Length Class and Refactoring
Since my last update, I have implemented a "Length" class to store a length with its unit and perform unit conversions and have begun porting code to the new class.
http://www.mpetroff.net/archives/2013/06/29/length-class-and-refactoring/
-Matthew
Hi Matthew (+ devs),
I'm afraid I haven't been following the discussion of your project in any detail because I'm super busy at the moment, but it certainly sounds like valuable work.
I just wanted to check that you've had a thorough look into external library support for unit handling... I spotted a few nice libraries a while ago when I was looking into options for physics simulation stuff but never actually made use of them yet. One possible option is the Boost Units library [1], which provides support for unit conversion etc. Since Boost is very widely available, it may be worth looking into this as an option?
Apologies if this has already been discussed or is irrelevant to the discussion... as I say, I haven't really been paying too much attention recently!
Best wishes,
Alex
[1] http://www.boost.org/doc/libs/1_53_0/doc/html/boost_units/Quick_Start.html
On 30 June 2013 01:18, Matthew Petroff <inkscape-devel@...2975...> wrote:
Since my last update, I have implemented a "Length" class to store a length with its unit and perform unit conversions and have begun porting code to the new class.
http://www.mpetroff.net/archives/2013/06/29/length-class-and-refactoring/
-Matthew
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On 30-6-2013 14:44, Alex Valavanis wrote:
Hi Matthew (+ devs),
I'm afraid I haven't been following the discussion of your project in any detail because I'm super busy at the moment, but it certainly sounds like valuable work.
I just wanted to check that you've had a thorough look into external library support for unit handling... I spotted a few nice libraries a while ago when I was looking into options for physics simulation stuff but never actually made use of them yet. One possible option is the Boost Units library [1], which provides support for unit conversion etc. Since Boost is very widely available, it may be worth looking into this as an option?
Apologies if this has already been discussed or is irrelevant to the discussion... as I say, I haven't really been paying too much attention recently!
Best wishes,
Alex
[1] http://www.boost.org/doc/libs/1_53_0/doc/html/boost_units/Quick_Start.html
Thanks for the pointer, I was not aware of this package, but we did not look for it either. Inkscape only needs "length" units (so far at least), so to me it feels much better to just handle that ourselves to keep the code/dependencies small. Most of the actual unit calculation code is already in Inkscape anyway. The GSoC project is to unify the unit handling, and to then improve the code to actually use user-specified units (instead of assuming "px" for example).
Cheers, Johan
On 30-6-2013 2:18, Matthew Petroff wrote:
Since my last update, I have implemented a "Length" class to store a length with its unit and perform unit conversions and have begun porting code to the new class.
http://www.mpetroff.net/archives/2013/06/29/length-class-and-refactoring/
Looks good to start with converting all code to use one unit handling system. Two comments: 1) the Length::convert could be a static method of the class, so it can be used without creating a Length object. 2) Inkscape::Util::Length is pretty lengthy (;-)). You may want to drop the "Util" at least...
Cheers, Johan
On Jul 1, 2013, at 2:13 PM, Johan Engelen wrote:
On 30-6-2013 2:18, Matthew Petroff wrote:
Since my last update, I have implemented a "Length" class to store a length with its unit and perform unit conversions and have begun porting code to the new class.
http://www.mpetroff.net/archives/2013/06/29/length-class-and-refactoring/
Looks good to start with converting all code to use one unit handling system. Two comments:
- the Length::convert could be a static method of the class, so it can
be used without creating a Length object. 2) Inkscape::Util::Length is pretty lengthy (;-)). You may want to drop the "Util" at least...
Of if you use the 'using declaration' you can keep the namespace but then skip it in the source file(s) using it.
using Inkscape::Util::Length;
...
Length foo;
That way files that include the declaration indirectly will not have any naming collisions, yet the consuming source files can keep brevity.
participants (4)
-
Alex Valavanis
-
Johan Engelen
-
Jon Cruz
-
Matthew Petroff