A possible error in livarot\MyMath.h

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

A possible error in livarot\MyMath.h

Alex S-4
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.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: A possible error in livarot/MyMath.h

Peter Moulder
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.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel