summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
commit509ca3687330fea576ea67ae6c7f31d16e66b800 (patch)
tree9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/2geom
parentupdated to latest trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.tar.gz
inkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.zip
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/2geom')
-rw-r--r--src/2geom/CMakeLists.txt12
-rw-r--r--src/2geom/Makefile_insert131
-rw-r--r--src/2geom/conicsec.cpp2
-rw-r--r--src/2geom/intersection-graph.cpp6
-rw-r--r--src/2geom/sbasis-geometric.cpp11
-rw-r--r--src/2geom/sbasis-to-bezier.cpp41
6 files changed, 45 insertions, 158 deletions
diff --git a/src/2geom/CMakeLists.txt b/src/2geom/CMakeLists.txt
index 97b47b630..d2c1ea50e 100644
--- a/src/2geom/CMakeLists.txt
+++ b/src/2geom/CMakeLists.txt
@@ -1,3 +1,7 @@
+# Override error flag just for this folder
+if (CMAKE_BUILD_TYPE MATCHES Strict)
+ set(CMAKE_CXX_FLAGS_STRICT "${CMAKE_CXX_FLAGS_STRICT} -Wno-error=deprecated-declarations")
+endif()
set(2geom_SRC
affine.cpp
@@ -60,13 +64,16 @@ set(2geom_SRC
bezier-to-sbasis.h
bezier-utils.h
bezier.h
+ cairo-path-sink.h
choose.h
circle.h
+ circulator.h
concepts.h
conic_section_clipper.h
conic_section_clipper_cr.h
conic_section_clipper_impl.h
conicsec.h
+ convex-hull.h
coord.h
crossing.h
curve.h
@@ -82,10 +89,13 @@ set(2geom_SRC
int-interval.h
int-point.h
int-rect.h
+ intersection-graph.h
+ intersection.h
interval.h
line.h
linear.h
math-utils.h
+ nearest-time.h
ord.h
path-intersection.h
path-sink.h
@@ -106,8 +116,8 @@ set(2geom_SRC
solver.h
svg-path-parser.h
svg-path-writer.h
- sweeper.h
sweep-bounds.h
+ sweeper.h
toposweep.h
transforms.h
utils.h
diff --git a/src/2geom/Makefile_insert b/src/2geom/Makefile_insert
deleted file mode 100644
index 4d41de297..000000000
--- a/src/2geom/Makefile_insert
+++ /dev/null
@@ -1,131 +0,0 @@
-## Makefile.am fragment sourced by src/Makefile.am.
-
-2geom/all: 2geom/lib2geom.a
-
-2geom/clean:
- rm -f 2geom/lib2geom.a $(2geom_lib2geom_a_OBJECTS)
-
-2geom_lib2geom_a_SOURCES = \
- 2geom/2geom.h \
- 2geom/affine.cpp \
- 2geom/affine.h \
- 2geom/angle.h \
- 2geom/basic-intersection.cpp \
- 2geom/basic-intersection.h \
- 2geom/bezier-clipping.cpp \
- 2geom/bezier-curve.cpp \
- 2geom/bezier-curve.h \
- 2geom/bezier.cpp \
- 2geom/bezier.h \
- 2geom/bezier-to-sbasis.h \
- 2geom/bezier-utils.cpp \
- 2geom/bezier-utils.h \
- 2geom/cairo-path-sink.cpp \
- 2geom/cairo-path-sink.h \
- 2geom/choose.h \
- 2geom/circle.cpp \
- 2geom/circle.h \
- 2geom/circulator.h \
- 2geom/CMakeLists.txt \
- 2geom/concepts.h \
- 2geom/conicsec.cpp \
- 2geom/conicsec.h \
- 2geom/conic_section_clipper_cr.h \
- 2geom/conic_section_clipper.h \
- 2geom/conic_section_clipper_impl.cpp \
- 2geom/conic_section_clipper_impl.h \
- 2geom/convex-hull.cpp \
- 2geom/convex-hull.h \
- 2geom/coord.cpp \
- 2geom/coord.h \
- 2geom/crossing.cpp \
- 2geom/crossing.h \
- 2geom/curve.cpp \
- 2geom/curve.h \
- 2geom/curves.h \
- 2geom/d2.h \
- 2geom/d2-sbasis.cpp \
- 2geom/ellipse.cpp \
- 2geom/ellipse.h \
- 2geom/elliptical-arc.cpp \
- 2geom/elliptical-arc.h \
- 2geom/elliptical-arc-from-sbasis.cpp \
- 2geom/exception.h \
- 2geom/forward.h \
- 2geom/generic-interval.h \
- 2geom/generic-rect.h \
- 2geom/geom.cpp \
- 2geom/geom.h \
- 2geom/intersection.h \
- 2geom/intersection-graph.cpp \
- 2geom/intersection-graph.h \
- 2geom/interval.h \
- 2geom/int-interval.h \
- 2geom/int-point.h \
- 2geom/int-rect.h \
- 2geom/linear.h \
- 2geom/line.cpp \
- 2geom/line.h \
- 2geom/math-utils.h \
- 2geom/nearest-time.cpp \
- 2geom/nearest-time.h \
- 2geom/ord.h \
- 2geom/path.cpp \
- 2geom/path.h \
- 2geom/path-intersection.cpp \
- 2geom/path-intersection.h \
- 2geom/path-sink.cpp \
- 2geom/path-sink.h \
- 2geom/pathvector.cpp \
- 2geom/pathvector.h \
- 2geom/piecewise.cpp \
- 2geom/piecewise.h \
- 2geom/point.cpp \
- 2geom/point.h \
- 2geom/polynomial.cpp \
- 2geom/polynomial.h \
- 2geom/ray.h \
- 2geom/rect.cpp \
- 2geom/rect.h \
- 2geom/recursive-bezier-intersection.cpp \
- 2geom/sbasis-2d.cpp \
- 2geom/sbasis-2d.h \
- 2geom/sbasis.cpp \
- 2geom/sbasis-curve.h \
- 2geom/sbasis-geometric.cpp \
- 2geom/sbasis-geometric.h \
- 2geom/sbasis.h \
- 2geom/sbasis-math.cpp \
- 2geom/sbasis-math.h \
- 2geom/sbasis-poly.cpp \
- 2geom/sbasis-poly.h \
- 2geom/sbasis-roots.cpp \
- 2geom/sbasis-to-bezier.cpp \
- 2geom/sbasis-to-bezier.h \
- 2geom/solve-bezier.cpp \
- 2geom/solve-bezier-one-d.cpp \
- 2geom/solve-bezier-parametric.cpp \
- 2geom/solver.h \
- 2geom/svg-path-parser.cpp \
- 2geom/svg-path-parser.h \
- 2geom/svg-path-writer.cpp \
- 2geom/svg-path-writer.h \
- 2geom/sweep-bounds.cpp \
- 2geom/sweep-bounds.h \
- 2geom/sweeper.h \
- 2geom/toposweep.cpp \
- 2geom/toposweep.h \
- 2geom/transforms.cpp \
- 2geom/transforms.h \
- 2geom/utils.cpp \
- 2geom/utils.h \
- 2geom/numeric/fitting-model.h \
- 2geom/numeric/fitting-tool.h \
- 2geom/numeric/linear_system.h \
- 2geom/numeric/matrix.cpp \
- 2geom/numeric/matrix.h \
- 2geom/numeric/symmetric-matrix-fs.h \
- 2geom/numeric/symmetric-matrix-fs-operation.h \
- 2geom/numeric/symmetric-matrix-fs-trace.h \
- 2geom/numeric/vector.h
-
diff --git a/src/2geom/conicsec.cpp b/src/2geom/conicsec.cpp
index 2d396ba30..3e0a53816 100644
--- a/src/2geom/conicsec.cpp
+++ b/src/2geom/conicsec.cpp
@@ -249,7 +249,7 @@ std::vector<Point> decompose_degenerate(xAx const & C1, xAx const & C2, xAx cons
(-A[1][0]*b[0] + A[0][0]*b[1]));
B0 *= ideterm;
Point n0, n1;
- // Are these just the eigenvectors of A11?
+ // Are these just the eigenvectors of A[1][1]?
if(xC0.c[0] == xC0.c[2]) {
double b = 0.5*xC0.c[1]/xC0.c[0];
double c = xC0.c[2]/xC0.c[0];
diff --git a/src/2geom/intersection-graph.cpp b/src/2geom/intersection-graph.cpp
index d469d3ffc..cac010942 100644
--- a/src/2geom/intersection-graph.cpp
+++ b/src/2geom/intersection-graph.cpp
@@ -410,10 +410,10 @@ PathVector PathIntersectionGraph::_getResult(bool enter_a, bool enter_b)
assert(!result.back().empty());
}
- /*if (n_processed != size() * 2) {
+ if (n_processed != size() * 2) {
std::cerr << "Processed " << n_processed << " intersections, expected " << (size() * 2) << std::endl;
- }*/
- assert(n_processed == size() * 2);
+ }
+ //assert(n_processed == size() * 2);
return result;
}
diff --git a/src/2geom/sbasis-geometric.cpp b/src/2geom/sbasis-geometric.cpp
index 8aaa15144..3fe27748e 100644
--- a/src/2geom/sbasis-geometric.cpp
+++ b/src/2geom/sbasis-geometric.cpp
@@ -101,7 +101,7 @@ static SBasis divide_by_t1k(SBasis const &a, int k) {
static D2<SBasis> RescaleForNonVanishingEnds(D2<SBasis> const &MM, double ZERO=1.e-4){
D2<SBasis> M = MM;
//TODO: divide by all the s at once!!!
- while ((M[0].size()>0||M[1].size()>0) &&
+ while ((M[0].size()>1||M[1].size()>1) &&
fabs(M[0].at0())<ZERO &&
fabs(M[1].at0())<ZERO &&
fabs(M[0].at1())<ZERO &&
@@ -109,12 +109,12 @@ static D2<SBasis> RescaleForNonVanishingEnds(D2<SBasis> const &MM, double ZERO=1
M[0] = divide_by_sk(M[0],1);
M[1] = divide_by_sk(M[1],1);
}
- while ((M[0].size()>0||M[1].size()>0) &&
+ while ((M[0].size()>1||M[1].size()>1) &&
fabs(M[0].at0())<ZERO && fabs(M[1].at0())<ZERO){
M[0] = divide_by_t0k(M[0],1);
M[1] = divide_by_t0k(M[1],1);
}
- while ((M[0].size()>0||M[1].size()>0) &&
+ while ((M[0].size()>1||M[1].size()>1) &&
fabs(M[0].at1())<ZERO && fabs(M[1].at1())<ZERO){
M[0] = divide_by_t1k(M[0],1);
M[1] = divide_by_t1k(M[1],1);
@@ -227,9 +227,9 @@ Geom::unitVector(D2<SBasis> const &V_in, double tol, unsigned order){
// -This approach is numerically bad. Find a stable way to rescale V_in to have non vanishing ends.
// -This done, unitVector will have jumps at zeros: fill the gaps with arcs of circles.
D2<SBasis> V = RescaleForNonVanishingEnds(V_in);
-
- if (V[0].isZero(0) && V[1].isZero(0))
+ if (V[0].isZero(tol) && V[1].isZero(tol))
return Piecewise<D2<SBasis> >(D2<SBasis>(Linear(1),SBasis()));
+
SBasis x = V[0], y = V[1];
SBasis r_eqn1, r_eqn2;
@@ -242,7 +242,6 @@ Geom::unitVector(D2<SBasis> const &V_in, double tol, unsigned order){
r_eqn1 = -(a*x+b*y);
r_eqn2 = Linear(1.)-(a*a+b*b);
-
for (unsigned k=1; k<=order; k++){
double r0 = (k<r_eqn1.size())? r_eqn1.at(k).at0() : 0;
double r1 = (k<r_eqn1.size())? r_eqn1.at(k).at1() : 0;
diff --git a/src/2geom/sbasis-to-bezier.cpp b/src/2geom/sbasis-to-bezier.cpp
index 64c07f35e..583fe9ba2 100644
--- a/src/2geom/sbasis-to-bezier.cpp
+++ b/src/2geom/sbasis-to-bezier.cpp
@@ -188,7 +188,8 @@ void sbasis_to_cubic_bezier (std::vector<Point> & bz, D2<SBasis> const& sb)
double xprime[2], yprime[2];
double midx = 0;
double midy = 0;
- double numer;
+ double midx_0, midy_0;
+ double numer[2], numer_0[2];
double denom;
double div;
@@ -239,21 +240,23 @@ void sbasis_to_cubic_bezier (std::vector<Point> & bz, D2<SBasis> const& sb)
midx = 8*midx - 4*bz[0][X] - 4*bz[3][X]; // re-define relative to center
midy = 8*midy - 4*bz[0][Y] - 4*bz[3][Y];
+ midx_0 = sb[X][1][0] + sb[X][1][1]; // zeroth order estimate
+ midy_0 = sb[Y][1][0] + sb[Y][1][1];
if ((std::abs(xprime[0]) < EPSILON) && (std::abs(yprime[0]) < EPSILON)
&& ((std::abs(xprime[1]) > EPSILON) || (std::abs(yprime[1]) > EPSILON))) { // degenerate handle at 0 : use distance of closest approach
- numer = midx*xprime[1] + midy*yprime[1];
+ numer[0] = midx*xprime[1] + midy*yprime[1];
denom = 3.0*(xprime[1]*xprime[1] + yprime[1]*yprime[1]);
delx[0] = 0;
dely[0] = 0;
- delx[1] = -xprime[1]*numer/denom;
- dely[1] = -yprime[1]*numer/denom;
+ delx[1] = -xprime[1]*numer[0]/denom;
+ dely[1] = -yprime[1]*numer[0]/denom;
} else if ((std::abs(xprime[1]) < EPSILON) && (std::abs(yprime[1]) < EPSILON)
&& ((std::abs(xprime[0]) > EPSILON) || (std::abs(yprime[0]) > EPSILON))) { // degenerate handle at 1 : ditto
- numer = midx*xprime[0] + midy*yprime[0];
+ numer[1] = midx*xprime[0] + midy*yprime[0];
denom = 3.0*(xprime[0]*xprime[0] + yprime[0]*yprime[0]);
- delx[0] = xprime[0]*numer/denom;
- dely[0] = yprime[0]*numer/denom;
+ delx[0] = xprime[0]*numer[1]/denom;
+ dely[0] = yprime[0]*numer[1]/denom;
delx[1] = 0;
dely[1] = 0;
} else if (std::abs(xprime[1]*yprime[0] - yprime[1]*xprime[0]) > // general case : fit mid fxn value
@@ -264,15 +267,21 @@ void sbasis_to_cubic_bezier (std::vector<Point> & bz, D2<SBasis> const& sb)
return;
denom = 3.0*(xprime[1]*yprime[0] - yprime[1]*xprime[0]);
for (int i = 0; i < 2; ++i) {
- numer = xprime[1 - i]*midy - yprime[1 - i]*midx;
- delx[i] = xprime[i]*numer/denom;
- dely[i] = yprime[i]*numer/denom;
+ numer_0[i] = xprime[1 - i]*midy_0 - yprime[1 - i]*midx_0;
+ numer[i] = xprime[1 - i]*midy - yprime[1 - i]*midx;
+ delx[i] = xprime[i]*numer[i]/denom;
+ dely[i] = yprime[i]*numer[i]/denom;
+ if (numer_0[i]*numer[i] < 0) // check for reversal of direction, LP Bug 1544680
+ return;
}
+ if (std::abs((numer[0] - numer_0[0])*numer_0[1]) > 10.0*std::abs((numer[1] - numer_0[1])*numer_0[0]) // check for asymmetry
+ || std::abs((numer[1] - numer_0[1])*numer_0[0]) > 10.0*std::abs((numer[0] - numer_0[0])*numer_0[1]))
+ return;
} else if ((xprime[0]*xprime[1] < 0) || (yprime[0]*yprime[1] < 0)) { // symmetric case : use distance of closest approach
- numer = midx*xprime[0] + midy*yprime[0];
+ numer[0] = midx*xprime[0] + midy*yprime[0];
denom = 6.0*(xprime[0]*xprime[0] + yprime[0]*yprime[0]);
- delx[0] = xprime[0]*numer/denom;
- dely[0] = yprime[0]*numer/denom;
+ delx[0] = xprime[0]*numer[0]/denom;
+ dely[0] = yprime[0]*numer[0]/denom;
delx[1] = -delx[0];
dely[1] = -dely[0];
} else { // anti-symmetric case : fit mid slope
@@ -291,10 +300,10 @@ void sbasis_to_cubic_bezier (std::vector<Point> & bz, D2<SBasis> const& sb)
}
if (midx*yprime[0] != midy*xprime[0]) {
denom = midx*yprime[0] - midy*xprime[0];
- numer = midx*(bz[3][Y] - bz[0][Y]) - midy*(bz[3][X] - bz[0][X]);
+ numer[0] = midx*(bz[3][Y] - bz[0][Y]) - midy*(bz[3][X] - bz[0][X]);
for (int i = 0; i < 2; ++i) {
- delx[i] = xprime[0]*numer/denom;
- dely[i] = yprime[0]*numer/denom;
+ delx[i] = xprime[0]*numer[0]/denom;
+ dely[i] = yprime[0]*numer[0]/denom;
}
} else { // linear case
for (int i = 0; i < 2; ++i) {