summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-05-08 12:09:07 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-05-08 12:09:07 +0000
commit7b7620b5dc7f3c57be46a5078f0bec2e3868f553 (patch)
treee58237111e89ce025b253c76eb6ae62f1f9d0e77 /src
parentFix node editing problems (diff)
downloadinkscape-7b7620b5dc7f3c57be46a5078f0bec2e3868f553.tar.gz
inkscape-7b7620b5dc7f3c57be46a5078f0bec2e3868f553.zip
Fix ellipse problems
(bzr r14059.2.5)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/!PLEASE DON'T MAKE CHANGES IN THESE FILES.README18
-rw-r--r--src/2geom/cairo-path-sink.cpp4
-rw-r--r--src/2geom/ellipse.cpp15
-rw-r--r--src/2geom/path.h6
-rw-r--r--src/2geom/svg-path-writer.cpp2
5 files changed, 26 insertions, 19 deletions
diff --git a/src/2geom/!PLEASE DON'T MAKE CHANGES IN THESE FILES.README b/src/2geom/!PLEASE DON'T MAKE CHANGES IN THESE FILES.README
index 3ced704c7..074921de2 100644
--- a/src/2geom/!PLEASE DON'T MAKE CHANGES IN THESE FILES.README
+++ b/src/2geom/!PLEASE DON'T MAKE CHANGES IN THESE FILES.README
@@ -1,9 +1,13 @@
-All code files in this directory are *direct* copies of the files in 2geom's BZR repo.
-If you want to change the code, please change it in 2geom, then copy the files here.
-Otherwise, I will probably miss that you changed something in Inkscape's copy, and
-destroy your changes by copying 2geom's files over it during the next time I update
-Inkscape's copy of 2geom.
- - Johan Engelen
+This is an in-tree copy of lib2geom, a 2D geometry library started
+by Inkscape developers. If you want to change code in 2Geom, you should
+commit it first to upstream repository and then execute this command:
+
+rsync -r --existing /path/to/lib2geom/src/2geom /path/to/inkscape/src/2geom
+
+The command above will only update existing files. If you add new files
+to 2Geom, you'll need to copy the new files manually. Same if you remove
+some files.
2geom's BZR repo = lp:lib2geom
-http://lib2geom.sourceforge.net \ No newline at end of file
+http://lib2geom.sourceforge.net
+
diff --git a/src/2geom/cairo-path-sink.cpp b/src/2geom/cairo-path-sink.cpp
index 244a08ba4..f327bf04d 100644
--- a/src/2geom/cairo-path-sink.cpp
+++ b/src/2geom/cairo-path-sink.cpp
@@ -31,7 +31,7 @@
#include <cairo.h>
#include <2geom/cairo-path-sink.h>
-#include <2geom/elliptical-arc.h>
+#include <2geom/svg-elliptical-arc.h>
namespace Geom {
@@ -71,7 +71,7 @@ void CairoPathSink::quadTo(Point const &p1, Point const &p2)
void CairoPathSink::arcTo(double rx, double ry, double angle,
bool large_arc, bool sweep, Point const &p)
{
- EllipticalArc arc(_current_point, rx, ry, angle, large_arc, sweep, p);
+ SVGEllipticalArc arc(_current_point, rx, ry, angle, large_arc, sweep, p);
// Cairo only does circular arcs.
// To do elliptical arcs, we must use a temporary transform.
Affine uct = arc.unitCircleTransform();
diff --git a/src/2geom/ellipse.cpp b/src/2geom/ellipse.cpp
index 9e927c9e8..f23c9b24e 100644
--- a/src/2geom/ellipse.cpp
+++ b/src/2geom/ellipse.cpp
@@ -180,7 +180,6 @@ Ellipse::arc(Point const &ip, Point const &inner, Point const &fp,
// The arc is larger than half of the ellipse if the inner point
// is on the same side of the line going from the initial
// to the final point as the center of the ellipse
- Line chord(ip, fp);
Point versor = fp - ip;
double sdist_c = cross(versor, _center - ip);
double sdist_inner = cross(versor, inner - ip);
@@ -225,9 +224,11 @@ Ellipse &Ellipse::operator*=(Rotate const &r)
Ellipse &Ellipse::operator*=(Affine const& m)
{
- Rotate a(_angle);
+ Affine a = Scale(ray(X), ray(Y)) * Rotate(_angle);
Affine mwot = m.withoutTranslation();
Affine am = a * mwot;
+ Point new_center = _center * m;
+
if (are_near(am.descrim(), 0)) {
double angle;
if (am[0] != 0) {
@@ -237,13 +238,11 @@ Ellipse &Ellipse::operator*=(Affine const& m)
} else {
angle = M_PI/2;
}
- Point v;
- sincos(angle, v[X], v[Y]);
- v *= am;
- _angle = atan2(v);
- _center *= m;
+ Point v = Point::polar(angle) * am;
+ _center = new_center;
_rays[X] = L2(v);
_rays[Y] = 0;
+ _angle = atan2(v);
return *this;
}
@@ -257,7 +256,7 @@ Ellipse &Ellipse::operator*=(Affine const& m)
std::swap(invm[1], invm[2]);
q *= invm;
setCoefficients(q[0], 2*q[1], q[3], 0, 0, -1);
- _center *= m;
+ _center = new_center;
return *this;
}
diff --git a/src/2geom/path.h b/src/2geom/path.h
index 6a6fa05ee..58afcfd8d 100644
--- a/src/2geom/path.h
+++ b/src/2geom/path.h
@@ -288,7 +288,11 @@ struct ShapeTraits<Path> {
* - Iterating between @a begin() and @a end_closed()
* will always iterate over a closed loop of segments.
* - Iterating between @a begin() and @a end_open() will always skip
- * the closing segment.
+ * the final linear closing segment.
+ *
+ * If the final point of the last "real" segment coincides exactly with the initial
+ * point of the first segment, the closing segment will be absent from both
+ * [begin(), end_open()) and [begin(), end_closed()).
*
* Normally, an exception will be thrown when you try to insert a curve
* that makes the path non-continuous. If you are working with unsanitized
diff --git a/src/2geom/svg-path-writer.cpp b/src/2geom/svg-path-writer.cpp
index e8083a8d1..1c40ba64e 100644
--- a/src/2geom/svg-path-writer.cpp
+++ b/src/2geom/svg-path-writer.cpp
@@ -150,7 +150,7 @@ void SVGPathWriter::arcTo(double rx, double ry, double angle,
_setCommand('A');
_current_pars.push_back(rx);
_current_pars.push_back(ry);
- _current_pars.push_back(angle);
+ _current_pars.push_back(rad_to_deg(angle));
_current_pars.push_back(large_arc ? 1. : 0.);
_current_pars.push_back(sweep ? 1. : 0.);
_current_pars.push_back(p[X]);