summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
committerMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
commita168040d5a452544328a1e6ad35aaac351f94d44 (patch)
treefae1ba829f543a473da281bd5fa6e4deabbf6912 /src/2geom
parentRemoved function pointers from SPObject and subclasses. (diff)
parentDutch translation update (diff)
downloadinkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz
inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/2geom')
-rw-r--r--src/2geom/Makefile_insert231
-rw-r--r--src/2geom/basic-intersection.cpp12
-rw-r--r--src/2geom/elliptical-arc.cpp2
-rw-r--r--src/2geom/recursive-bezier-intersection.cpp11
-rw-r--r--src/2geom/solve-bezier-parametric.cpp27
5 files changed, 168 insertions, 115 deletions
diff --git a/src/2geom/Makefile_insert b/src/2geom/Makefile_insert
index e3b6fcdab..07e066df5 100644
--- a/src/2geom/Makefile_insert
+++ b/src/2geom/Makefile_insert
@@ -6,112 +6,129 @@
rm -f 2geom/lib2geom.a $(2geom_lib2geom_a_OBJECTS)
2geom_lib2geom_a_SOURCES = \
- 2geom/affine.h \
- 2geom/affine.cpp \
- 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.h \
- 2geom/bezier-to-sbasis.h \
- 2geom/bezier-utils.cpp \
- 2geom/bezier-utils.h \
- 2geom/choose.h \
- 2geom/circle-circle.cpp \
- 2geom/circle.cpp \
- 2geom/circle.h \
- 2geom/circulator.h \
- 2geom/concepts.h \
- 2geom/conjugate_gradient.cpp \
- 2geom/conjugate_gradient.h \
- 2geom/convex-cover.cpp \
- 2geom/convex-cover.h \
- 2geom/coord.h \
- 2geom/crossing.cpp \
- 2geom/crossing.h \
+ 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.h \
+ 2geom/bezier-to-sbasis.h \
+ 2geom/bezier-utils.cpp \
+ 2geom/bezier-utils.h \
+ 2geom/choose.h \
+ 2geom/circle-circle.cpp \
+ 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/conjugate_gradient.cpp \
+ 2geom/conjugate_gradient.h \
+ 2geom/convex-cover.cpp \
+ 2geom/convex-cover.h \
+ 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/d2-sbasis.h \
- 2geom/ellipse.cpp \
- 2geom/ellipse.h \
- 2geom/elliptical-arc.cpp \
- 2geom/elliptical-arc.h \
- 2geom/exception.h \
- 2geom/forward.h \
- 2geom/geom.cpp \
- 2geom/geom.h \
- 2geom/hvlinesegment.h \
- 2geom/interval.h \
- 2geom/isnan.h \
- 2geom/linear.h \
- 2geom/line.cpp \
- 2geom/line.h \
- 2geom/nearest-point.cpp \
- 2geom/nearest-point.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/vector.h \
- 2geom/ord.h \
- 2geom/path.cpp \
- 2geom/path.h \
- 2geom/path-intersection.cpp \
- 2geom/path-intersection.h \
- 2geom/pathvector.cpp \
- 2geom/pathvector.h \
- 2geom/piecewise.cpp \
- 2geom/piecewise.h \
- 2geom/point.cpp \
- 2geom/point.h \
- 2geom/point-l.h \
- 2geom/point-ops.h \
- 2geom/poly.cpp \
- 2geom/poly.h \
- 2geom/quadtree.cpp \
- 2geom/quadtree.h \
- 2geom/ray.h \
- 2geom/rect.cpp \
- 2geom/rect.h \
- 2geom/region.cpp \
- 2geom/region.h \
- 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/shape.cpp \
- 2geom/shape.h \
- 2geom/solve-bezier.cpp \
- 2geom/solve-bezier-one-d.cpp \
- 2geom/solve-bezier-parametric.cpp \
- 2geom/solver.h \
- 2geom/sturm.h \
- 2geom/svg-elliptical-arc.cpp \
- 2geom/svg-elliptical-arc.h \
- 2geom/svg-path.cpp \
- 2geom/svg-path.h \
- 2geom/svg-path-parser.cpp \
- 2geom/svg-path-parser.h \
- 2geom/sweep.cpp \
- 2geom/sweep.h \
- 2geom/transforms.cpp \
- 2geom/transforms.h \
- 2geom/utils.cpp \
- 2geom/utils.h
+ 2geom/curve.h \
+ 2geom/curves.h \
+ 2geom/d2.h \
+ 2geom/d2-sbasis.cpp \
+ 2geom/d2-sbasis.h \
+ 2geom/ellipse.cpp \
+ 2geom/ellipse.h \
+ 2geom/elliptical-arc.cpp \
+ 2geom/elliptical-arc.h \
+ 2geom/exception.h \
+ 2geom/forward.h \
+ 2geom/generic-interval.h \
+ 2geom/generic-rect.h \
+ 2geom/geom.cpp \
+ 2geom/geom.h \
+ 2geom/hvlinesegment.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-point.cpp \
+ 2geom/nearest-point.h \
+ 2geom/ord.h \
+ 2geom/path.cpp \
+ 2geom/path.h \
+ 2geom/path-intersection.cpp \
+ 2geom/path-intersection.h \
+ 2geom/pathvector.cpp \
+ 2geom/pathvector.h \
+ 2geom/piecewise.cpp \
+ 2geom/piecewise.h \
+ 2geom/point.cpp \
+ 2geom/point.h \
+ 2geom/point-ops.h \
+ 2geom/poly.cpp \
+ 2geom/poly.h \
+ 2geom/quadtree.cpp \
+ 2geom/quadtree.h \
+ 2geom/ray.h \
+ 2geom/rect.cpp \
+ 2geom/rect.h \
+ 2geom/recursive-bezier-intersection.cpp \
+ 2geom/region.cpp \
+ 2geom/region.h \
+ 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/shape.cpp \
+ 2geom/shape.h \
+ 2geom/solve-bezier.cpp \
+ 2geom/solve-bezier-one-d.cpp \
+ 2geom/solve-bezier-parametric.cpp \
+ 2geom/solver.h \
+ 2geom/svg-elliptical-arc.cpp \
+ 2geom/svg-elliptical-arc.h \
+ 2geom/svg-path.cpp \
+ 2geom/svg-path.h \
+ 2geom/svg-path-parser.cpp \
+ 2geom/svg-path-parser.h \
+ 2geom/sweep.cpp \
+ 2geom/sweep.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/basic-intersection.cpp b/src/2geom/basic-intersection.cpp
index 3be6792b9..544bf0dd1 100644
--- a/src/2geom/basic-intersection.cpp
+++ b/src/2geom/basic-intersection.cpp
@@ -64,7 +64,12 @@ void find_intersections(std::vector< std::pair<double, double> > & xs,
void split(vector<Point> const &p, double t,
vector<Point> &left, vector<Point> &right) {
const unsigned sz = p.size();
- Geom::Point Vtemp[sz][sz];
+
+ Geom::Point **Vtemp = new Geom::Point* [sz];
+
+ for (unsigned int i = 0; i < sz; ++i) {
+ Vtemp[i] = new Geom::Point[sz];
+ }
/* Copy control points */
std::copy(p.begin(), p.end(), Vtemp[0]);
@@ -82,6 +87,11 @@ void split(vector<Point> const &p, double t,
left[j] = Vtemp[j][0];
for (unsigned j = 0; j < sz; j++)
right[j] = Vtemp[sz-1-j][j];
+
+ for (unsigned int i = 0; i < sz; ++i)
+ delete[] Vtemp[i];
+
+ delete[] Vtemp;
}
diff --git a/src/2geom/elliptical-arc.cpp b/src/2geom/elliptical-arc.cpp
index 75b6777a2..29e983ad4 100644
--- a/src/2geom/elliptical-arc.cpp
+++ b/src/2geom/elliptical-arc.cpp
@@ -202,7 +202,7 @@ std::vector<Coord> EllipticalArc::roots(Coord v, Dim2 d) const
{
return sol;
}
- double ray_prj;
+ double ray_prj = 0.0;
switch(d)
{
case X:
diff --git a/src/2geom/recursive-bezier-intersection.cpp b/src/2geom/recursive-bezier-intersection.cpp
index b4c81e08e..7db0438a7 100644
--- a/src/2geom/recursive-bezier-intersection.cpp
+++ b/src/2geom/recursive-bezier-intersection.cpp
@@ -81,7 +81,11 @@ const double INV_EPS = (1L<<14);
*/
void OldBezier::split(double t, OldBezier &left, OldBezier &right) const {
const unsigned sz = p.size();
- Geom::Point Vtemp[sz][sz];
+
+ Geom::Point **Vtemp = new Geom::Point* [sz];
+
+ for (unsigned int i = 0; i < sz; ++i)
+ Vtemp[i] = new Geom::Point[sz];
/* Copy control points */
std::copy(p.begin(), p.end(), Vtemp[0]);
@@ -99,6 +103,11 @@ void OldBezier::split(double t, OldBezier &left, OldBezier &right) const {
left.p[j] = Vtemp[j][0];
for (unsigned j = 0; j < sz; j++)
right.p[j] = Vtemp[sz-1-j][j];
+
+ for (unsigned int i = 0; i < sz; ++i)
+ delete[] Vtemp[i];
+
+ delete[] Vtemp;
}
#if 0
diff --git a/src/2geom/solve-bezier-parametric.cpp b/src/2geom/solve-bezier-parametric.cpp
index 76cf65e17..ed693c584 100644
--- a/src/2geom/solve-bezier-parametric.cpp
+++ b/src/2geom/solve-bezier-parametric.cpp
@@ -68,13 +68,20 @@ find_parametric_bezier_roots(Geom::Point const *w, /* The control points */
break;
}
- /* Otherwise, solve recursively after subdividing control polygon */
- Geom::Point Left[degree+1], /* New left and right */
- Right[degree+1]; /* control polygons */
+ /*
+ * Otherwise, solve recursively after subdividing control polygon
+ * New left and right control polygons
+ */
+ Geom::Point *Left = new Geom::Point[degree+1];
+ Geom::Point *Right = new Geom::Point[degree+1];
+
Bezier(w, degree, 0.5, Left, Right);
total_subs ++;
find_parametric_bezier_roots(Left, degree, solutions, depth+1);
find_parametric_bezier_roots(Right, degree, solutions, depth+1);
+
+ delete[] Left;
+ delete[] Right;
}
@@ -191,7 +198,10 @@ Bezier(Geom::Point const *V, /* Control pts */
Geom::Point *Left, /* RETURN left half ctl pts */
Geom::Point *Right) /* RETURN right half ctl pts */
{
- Geom::Point Vtemp[degree+1][degree+1];
+ Geom::Point **Vtemp = new Geom::Point* [degree+1];
+
+ for (unsigned int i = 0; i < degree+1; ++i)
+ Vtemp[i] = new Geom::Point[degree+1];
/* Copy control points */
std::copy(V, V+degree+1, Vtemp[0]);
@@ -208,7 +218,14 @@ Bezier(Geom::Point const *V, /* Control pts */
for (unsigned j = 0; j <= degree; j++)
Right[j] = Vtemp[degree-j][j];
- return (Vtemp[degree][0]);
+ Geom::Point return_value = Vtemp[degree][0];
+
+ for (unsigned int i = 0; i < degree+1; ++i)
+ delete[] Vtemp[i];
+
+ delete[] Vtemp;
+
+ return return_value;
}
};