I am new to InkScape, but from what I remember from math lessons the dot product and the cross product as defined in the file have been confused.
Dot is defined to be x*x + y*y, but in this file the author defined cross to be x*x + y*y. And also cross should be x*y - y*x, but the author defined Dot to be x*y - y*x.
Thanks, Alex.
On Wed, Jun 29, 2005 at 11:40:08AM +0200, Alex S wrote:
Dot is defined to be x*x + y*y, but in this file the author defined cross to be x*x + y*y. And also cross should be x*y - y*x, but the author defined Dot to be x*y
- y*x.
Thankfully, neither that Dot nor Cross macro is used in current code, so I've simply removed both macros.
Incidentally, libnr/nr-point-fns.h has a dot function with the correct definition, and a cross function that arguably gives the wrong sign, depending on what you expect, e.g. whether you think y increases upwards or downwards, and whether you think of cross in terms of dot product with rotation in a certain direction or in terms of the basic scalar operations. (I'm assuming that the conventional definition of (a cross b) for two-dimensional vectors is ax * by - ay * bx.)
By Inkscape's angle conventions & its rationale (see below) (and with the above assumption as to the traditional mathematical definition), the cross function should be changed:
# Angle direction in Inkscape code: If you use the traditional # mathematics convention that y increases upwards, then positive angles # are anticlockwise as per the mathematics convention. If you take the # common non-mathematical convention that y increases downwards, then # positive angles are clockwise, as is common outside of mathematics.
This convention is intended to reduce problems with interfacing with libraries & humans that use the mathematical convention.
Now that fred (the author of that cross function and most or all of its callers) is no longer working on Inkscape, I might get around to doing a mass change some time after 0.42 is released; though it's not very high priority of course.
pjrm.
participants (2)
-
Alex S
-
Peter Moulder