summaryrefslogtreecommitdiffstats
path: root/src/2geom
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-02-08 15:40:25 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-02-08 15:40:25 +0000
commit86891a9e442c81435c6d197cb09b3dc210643bc0 (patch)
tree4952411fd6e526907d4241e8965e93c4f185500a /src/2geom
parentrefactor of pointwise base (diff)
downloadinkscape-86891a9e442c81435c6d197cb09b3dc210643bc0.tar.gz
inkscape-86891a9e442c81435c6d197cb09b3dc210643bc0.zip
starting whith pointwise
(bzr r13645.1.7)
Diffstat (limited to 'src/2geom')
-rw-r--r--src/2geom/Makefile_insert3
-rw-r--r--src/2geom/pointwise.cpp6
-rw-r--r--src/2geom/pointwise.h16
-rw-r--r--src/2geom/satellite-enum.h2
-rw-r--r--src/2geom/satellite.h28
5 files changed, 42 insertions, 13 deletions
diff --git a/src/2geom/Makefile_insert b/src/2geom/Makefile_insert
index e77f413cb..2f23bc442 100644
--- a/src/2geom/Makefile_insert
+++ b/src/2geom/Makefile_insert
@@ -80,6 +80,8 @@
2geom/point.cpp \
2geom/point.h \
2geom/point-ops.h \
+ 2geom/pointwise.cpp \
+ 2geom/pointwise.h \
2geom/poly.cpp \
2geom/poly.h \
2geom/quadtree.cpp \
@@ -90,6 +92,7 @@
2geom/recursive-bezier-intersection.cpp \
2geom/region.cpp \
2geom/region.h \
+ 2geom/satellite.h \
2geom/sbasis-2d.cpp \
2geom/sbasis-2d.h \
2geom/sbasis.cpp \
diff --git a/src/2geom/pointwise.cpp b/src/2geom/pointwise.cpp
index ce3aa86f6..cd7f7914f 100644
--- a/src/2geom/pointwise.cpp
+++ b/src/2geom/pointwise.cpp
@@ -1,6 +1,8 @@
/*
- * pointwise.cpp - Pointwise function class
- *
+ * pointwise.cpp
+ * Authors:
+ * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
+ * Copyright 2015 authors
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
diff --git a/src/2geom/pointwise.h b/src/2geom/pointwise.h
index 33289f4f0..c0974f54c 100644
--- a/src/2geom/pointwise.h
+++ b/src/2geom/pointwise.h
@@ -3,10 +3,20 @@
* \brief Pointwise
*//*
* Authors:
+ * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
+ * Copyright 2015 authors
*
- * Copyright 2014 authors
- *
- *
+ * Pointwise maintains a set of "Satellite" positions along a curve/pathvector.
+ * The positions are specified as arc length distances along the curve or by
+ * time in the curve. Splicing operations automatically update the satellite
+ * positions to preserve the intent.
+ * The data is serialised to SVG using a specialiced pointwise LPE parameter to
+ * handle it in th future can be a inkscape based property to paths
+ * //all operations are O(1) per satellite, with the exception of .., .., and .., which
+ * //need to use binary search to find the locations.
+ * Anywhere a Piecewise is used, a Pointwise can be substituted, allowing
+ * existing algorithms to correctly update satellite positions.
+
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
diff --git a/src/2geom/satellite-enum.h b/src/2geom/satellite-enum.h
index 3872cf718..a71306bc9 100644
--- a/src/2geom/satellite-enum.h
+++ b/src/2geom/satellite-enum.h
@@ -20,7 +20,7 @@ enum SatelliteType {
INVERSE_CHAMFER,
INVALID_SATELLITE // This must be last (I made it such that it is not needed anymore I think..., Don't trust on it being last. - johan)
};
-
+std::map<gchar const *value, SatelliteType> SatelliteTypeMap = boost::map_list_of("FILLET", FILLET)("INVERSE_FILLET", INVERSE_FILLET)("CHAMFER",CHAMFER)("INVERSE_CHAMFER",INVERSE_CHAMFER)("INVALID_SATELLITE",INVALID_SATELLITE);
extern const Util::EnumData<SatelliteType> SATELLITETypeData[]; /// defined in satelite.cpp
extern const Util::EnumDataConverter<SateliteType> SATELLITETypeConverter; /// defined in sattelite.cpp
diff --git a/src/2geom/satellite.h b/src/2geom/satellite.h
index 8e570db4c..a18b08f27 100644
--- a/src/2geom/satellite.h
+++ b/src/2geom/satellite.h
@@ -3,8 +3,8 @@
* \brief Satellite
*//*
* Authors:
- *
- * Copyright 2014 authors
+ * 2015 Jabier Arraiza Cenoz<jabier.arraiza@marker.es>
+ * Copyright 2015 authors
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@@ -129,16 +129,30 @@ class Satellite
return _time;
}
- double toTime(double A,D2<SBasis> curve) const
+ double time(D2<SBasis> curve) const
{
//todo make the process
return _time;
}
- double toSize(double A,D2<SBasis> curve) const
- {
- //todo make the process
- return _size;
+ void setPosition(Geom::Point p, D2<SBasis> curve){
+ _time = Geom::nearestPoint(p, curve);
+ if(!_isTime){
+ if (curve.degreesOfFreedom() != 2) {
+ Piecewise<D2<SBasis> > u;
+ u.push_cut(0);
+ u.push(curve, 1);
+ u = portion(u, 0, _time);
+ _size = length(u, 0.001) * -1;
+ } else {
+ lenghtPart = length(last_pwd2[index], EPSILON);
+ _size = (time * lenghtPart) * -1;
+ }
+ }
+ }
+
+ Geom::Point getPosition(D2<SBasis> curve){
+ return curve.pointAt(_time);
}
bool isDegenerate() const