summaryrefslogtreecommitdiffstats
path: root/src/2geom/point.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-02-05 01:06:18 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-02-05 01:06:18 +0000
commitf6809cd36481d5e20de106c23e3db527b026b417 (patch)
tree2c44b8e15ce76314a357d7098a5c2039e336a201 /src/2geom/point.cpp
parenttemporary work around 2geom matrix bug to make inkscape more usable (diff)
downloadinkscape-f6809cd36481d5e20de106c23e3db527b026b417.tar.gz
inkscape-f6809cd36481d5e20de106c23e3db527b026b417.zip
Properly fix seltrans brokenness in 2Geom and pull updated files
into Inkscape (bzr r10034)
Diffstat (limited to 'src/2geom/point.cpp')
-rw-r--r--src/2geom/point.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/2geom/point.cpp b/src/2geom/point.cpp
index 9df88df92..a9005ef61 100644
--- a/src/2geom/point.cpp
+++ b/src/2geom/point.cpp
@@ -146,8 +146,8 @@ Point unit_vector(Point const &a)
}
/** @brief Return the "absolute value" of the point's vector.
* This is defined in terms of the default lexicographical ordering. If the point is "larger"
- * that the origin (0, 0), its negation is returned. This corresponds to making the Y coordinate
- * positive. You can check whether the points' vectors have the same direction (e.g. lie
+ * that the origin (0, 0), its negation is returned. You can check whether
+ * the points' vectors have the same direction (e.g. lie
* on the same line passing through the origin) using
* @code abs(a).normalize() == abs(b).normalize() @endcode.
* To check with some margin of error, use
@@ -158,8 +158,14 @@ Point unit_vector(Point const &a)
* @relates Point */
Point abs(Point const &b)
{
- Point ret = b;
- ret[Y] = fabs(ret[Y]);
+ Point ret;
+ if (b[Y] < 0.0) {
+ ret = -b;
+ } else if (b[Y] == 0.0) {
+ ret = b[X] < 0.0 ? -b : b;
+ } else {
+ ret = b;
+ }
return ret;
}