Matrix multiplication reversed?

I am attempting to eliminate some redundant types, at the moment I have just tried eliminating NRPoint and NRMatrix in favour of NR::Point and NR::Matrix (patch available soon, I'm currently double-checking it).
While looking at the matrix multiplication as defined in nr-matrix.cpp it looks like the definition is reversed (compared to the usualy mathematical definition). That is: A*B=BA ...
The reason I think it is reversed is simply that if C=A*B (with C, A and B NR::Matrix's), then C[0] is the dot product between the first column of A and the first row of B (and similarly for the other elements).
Am I missing something or is it indeed reversed? And if it is, is there a reason for this?

-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Jasper van de Gronde Sent: maandag 17 maart 2008 16:26 To: inkscape Subject: [Inkscape-devel] Matrix multiplication reversed?
I am attempting to eliminate some redundant types, at the moment I have just tried eliminating NRPoint and NRMatrix in favour of NR::Point and NR::Matrix (patch available soon, I'm currently double-checking it).
Although I can't help you now on the reversal issue, I want to place a comment: Why not eliminate them in favor of 2Geom's points and matrices ? Is the change NRPoint => NR::Point so tiny?
Regards, Johan

On Mon, 17 Mar 2008 18:05:51 +0100, J.B.C.Engelen@...1578... wrote:
Although I can't help you now on the reversal issue, I want to place a comment: Why not eliminate them in favor of 2Geom's points and matrices ? Is the change NRPoint => NR::Point so tiny?
That appears to be what he's doing.
-mental

-----Original Message----- From: MenTaLguY [mailto:mental@...3...] Sent: maandag 17 maart 2008 18:12 To: Engelen, J.B.C. (Johan) Cc: th.v.d.gronde@...528...; inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] Matrix multiplication reversed?
On Mon, 17 Mar 2008 18:05:51 +0100, J.B.C.Engelen@...1578... wrote:
Although I can't help you now on the reversal issue, I want
to place a
comment: Why not eliminate them in favor of 2Geom's points and matrices ? Is the change NRPoint => NR::Point so tiny?
That appears to be what he's doing.
I'm sorry, I'm confused by your comment mental. What were you referring to? I meant "is the change NRPoint => NR::Point so tiny, that it is very easy etc etc and to 2geom would be more difficult so will just convert to NR::Point"

J.B.C.Engelen@...1578... wrote:
-----Original Message----- From: MenTaLguY [mailto:mental@...3...] ... On Mon, 17 Mar 2008 18:05:51 +0100, J.B.C.Engelen@...1578... wrote:
Although I can't help you now on the reversal issue, I want
to place a
comment: Why not eliminate them in favor of 2Geom's points and matrices ? Is the change NRPoint => NR::Point so tiny?
That appears to be what he's doing.
I'm sorry, I'm confused by your comment mental. What were you referring to? I meant "is the change NRPoint => NR::Point so tiny, that it is very easy etc etc and to 2geom would be more difficult so will just convert to NR::Point"
More like the other way around, NR::Point => Geom::Point (and similarly for Matrix and friends) shouldn't be that hard (they're very, very similar), but I thought I'd first eliminate the old NR structures.

-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of Jasper van de Gronde Sent: maandag 17 maart 2008 19:16 To: Engelen, J.B.C. (Johan) Cc: inkscape-devel@lists.sourceforge.net; mental@...3... Subject: Re: [Inkscape-devel] Matrix multiplication reversed?
J.B.C.Engelen@...1578... wrote:
-----Original Message----- From: MenTaLguY [mailto:mental@...3...] ... On Mon, 17 Mar 2008 18:05:51 +0100, J.B.C.Engelen@...1578... wrote:
Although I can't help you now on the reversal issue, I want
to place a
comment: Why not eliminate them in favor of 2Geom's points and
matrices ? Is
the change NRPoint => NR::Point so tiny?
That appears to be what he's doing.
I'm sorry, I'm confused by your comment mental. What were
you referring to?
I meant "is the change NRPoint => NR::Point so tiny, that
it is very easy etc etc and to 2geom would be more difficult so will just convert to NR::Point"
More like the other way around, NR::Point => Geom::Point (and similarly for Matrix and friends) shouldn't be that hard (they're very, very similar), but I thought I'd first eliminate the old NR structures.
Yes I know, that's why I was wondering why you'd go via NR::Point and not just directly :). I'd like to convert things to 2geom for gsoc this year. Probably you've seen my NR::Point::to_2geom() method and friends?
The matrix reversal is a good find though. Did you have a look how 2geom does it?
Thanks, Groeten! :-) Johan

J.B.C.Engelen@...1578... wrote:
... More like the other way around, NR::Point => Geom::Point (and similarly for Matrix and friends) shouldn't be that hard (they're very, very similar), but I thought I'd first eliminate the old NR structures.
Yes I know, that's why I was wondering why you'd go via NR::Point and not just directly :). I'd like to convert things to 2geom for gsoc this year. Probably you've seen my NR::Point::to_2geom() method and friends?
Definitely, but since I probably won't have a lot of time for the rest of this week I'll post a patch for this change first (as soon as I've double-checked the last few changes). One of the reasons to attack this first was that some things were implemented two, or even three, times in the same set of libnr files alone!
The matrix reversal is a good find though. Did you have a look how 2geom does it?
Yes, it does it in exactly the same way, and so do the optimized matrix multiplications for NR::translate, NR::scale and NR::rotate. I have not checked what Cairo does. (BTW, I just read in njh's mail that there probably indeed was a good reason to do this.)
participants (3)
-
unknown@example.com
-
Jasper van de Gronde
-
MenTaLguY