Re: [Inkscape-devel] mass conversion to Geom::Point
Op Di, 12 augustus, 2008 01:11, schreef J.B.C.Engelen@...1578...:
Often it is not needed to add to_2geom/from_2geom, so please don't! The conversion goes automatically between NR::Point <=> Geom::Point and NR::Matrix <=> Geom::Matrix. Only ambiguities need a little more guideance: void some_function(NR::Point nr) Geom::Point geom; Geom::Point ambiguous = nr - geom;
What about methods that require parameters by reference for getting data both in and out? Will the implicit casting work correctly for those too? Maybe I should just try that myself; there are quite some snapping calls requiring Geom::Point& (without being const). It would be great if I could just pass a NR::Point. So far I've used dummy variables for that.
It's quite cumbersome indeed to transfer everything to 2geom. Last weekend I had a shot at the snapping code, but I have caused some regressions which need to be fixed first.
I guess Johan could still use some additional hands.
Regards,
Diederik
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Diederik van Lierop Sent: dinsdag 12 augustus 2008 8:13 To: Engelen, J.B.C. (Johan) Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] mass conversion to Geom::Point
Op Di, 12 augustus, 2008 01:11, schreef J.B.C.Engelen@...1578...:
Often it is not needed to add to_2geom/from_2geom, so please don't! The conversion goes automatically between NR::Point <=> Geom::Point and NR::Matrix <=> Geom::Matrix. Only ambiguities need a little more guideance: void some_function(NR::Point nr) Geom::Point geom; Geom::Point ambiguous = nr - geom;
What about methods that require parameters by reference for getting data both in and out? Will the implicit casting work correctly for those too? Maybe I should just try that myself; there are quite some snapping calls requiring Geom::Point& (without being const). It would be great if I could just pass a NR::Point. So far I've used dummy variables for that.
If the function requires Geom::Point&, the cast cannot be done implicitly and also not with to_2geom(). Geom::Point const& *can* be done implicitly, so... Does your snapping method really need a non-const reference? If so, you need a dummy variable, or often, this can also be solved by changing the type of the parameter that is passed in the calling function. (so no dummy variable)
Thanks again Diederik,
Johan
participants (2)
-
unknown@example.com
-
Diederik van Lierop