summaryrefslogtreecommitdiffstats
path: root/src/helper
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-08-23 22:58:37 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-08-23 22:58:37 +0000
commit89b565d68326ada49d11d0735ffb6b602c26a54f (patch)
treeb8d264231211485f47e9f72c87f8054c912061da /src/helper
parentsatellites in curves (diff)
downloadinkscape-89b565d68326ada49d11d0735ffb6b602c26a54f.tar.gz
inkscape-89b565d68326ada49d11d0735ffb6b602c26a54f.zip
Cached some functions
(bzr r13645.1.111)
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/geom-pointwise.cpp20
-rw-r--r--src/helper/geom-pointwise.h1
-rw-r--r--src/helper/geom-satellite.cpp4
3 files changed, 13 insertions, 12 deletions
diff --git a/src/helper/geom-pointwise.cpp b/src/helper/geom-pointwise.cpp
index 8ae2125a4..9aa90df01 100644
--- a/src/helper/geom-pointwise.cpp
+++ b/src/helper/geom-pointwise.cpp
@@ -27,7 +27,7 @@ void Pointwise::setPwd2(pwd2sb const &pwd2_in)
_pwd2 = pwd2_in;
}
-std::vector<Satellite> Pointwise::getSatellites(e)
+std::vector<Satellite> Pointwise::getSatellites()
{
return _satellites;
}
@@ -80,10 +80,10 @@ void Pointwise::pwd2Subtract(pwd2sb const &A)
std::vector<Satellite> sats;
pwd2sb pwd2 = _pwd2;
setPwd2(A);
- Geom::PathVector pointwise_pv = path_from_piecewise(Geom::remove_short_cuts(_pwd2,0.01),0.01);
+ Geom::PathVector pathv = path_from_piecewise(Geom::remove_short_cuts(_pwd2,0.01),0.01);
for (size_t i = 0; i < _satellites.size(); i++) {
- Geom::Path sat_path = pointwise_pv.pathAt(i - counter);
- Geom::PathTime sat_curve_time = sat_path.nearestTime(pointwise_pv.curveAt(i - counter).initialPoint());
+ Geom::Path sat_path = pathv.pathAt(i - counter);
+ Geom::PathTime sat_curve_time = sat_path.nearestTime(pathv.curveAt(i - counter).initialPoint());
Geom::PathTime sat_curve_time_start = sat_path.nearestTime(sat_path.initialPoint());
if (sat_curve_time_start.curve_index < sat_curve_time.curve_index||
!are_near(pwd2[i].at0(), A[i - counter].at0())) {
@@ -101,9 +101,9 @@ void Pointwise::pwd2Append(pwd2sb const &A, Satellite const &S)
std::vector<Satellite> sats;
bool reorder = false;
for (size_t i = 0; i < A.size(); i++) {
- Geom::PathVector pointwise_pv = path_from_piecewise(Geom::remove_short_cuts(_pwd2,0.01),0.01);
- Geom::Path sat_path = pointwise_pv.pathAt(i - counter);
- boost::optional< Geom::PathVectorTime > sat_curve_time_optional = pointwise_pv.nearestTime(pointwise_pv.curveAt(i-counter).initialPoint());
+ Geom::PathVector pathv = path_from_piecewise(Geom::remove_short_cuts(_pwd2,0.01),0.01);
+ Geom::Path sat_path = pathv.pathAt(i - counter);
+ boost::optional< Geom::PathVectorTime > sat_curve_time_optional = pathv.nearestTime(pathv.curveAt(i-counter).initialPoint());
Geom::PathVectorTime sat_curve_time;
if(sat_curve_time_optional) {
sat_curve_time = *sat_curve_time_optional;
@@ -118,9 +118,9 @@ void Pointwise::pwd2Append(pwd2sb const &A, Satellite const &S)
//Check for subpath closed. If a subpath is closed, is not reversed or moved
//to back
size_t old_subpath_index = sat_curve_time.path_index;
- pointwise_pv = path_from_piecewise(Geom::remove_short_cuts(A,0.01),0.01);
- sat_path = pointwise_pv.pathAt(i);
- sat_curve_time_optional = pointwise_pv.nearestTime(pointwise_pv.curveAt(i).initialPoint());
+ pathv = path_from_piecewise(Geom::remove_short_cuts(A,0.01),0.01);
+ sat_path = pathv.pathAt(i);
+ sat_curve_time_optional = pathv.nearestTime(pathv.curveAt(i).initialPoint());
if(sat_curve_time_optional) {
sat_curve_time = *sat_curve_time_optional;
}
diff --git a/src/helper/geom-pointwise.h b/src/helper/geom-pointwise.h
index 9d2993a23..a2324accd 100644
--- a/src/helper/geom-pointwise.h
+++ b/src/helper/geom-pointwise.h
@@ -64,6 +64,7 @@ public:
private:
pwd2sb _pwd2;
+ Geom::PathVector _pathvector;
std::vector<Satellite> _satellites;
};
diff --git a/src/helper/geom-satellite.cpp b/src/helper/geom-satellite.cpp
index 10afca725..35d21ef32 100644
--- a/src/helper/geom-satellite.cpp
+++ b/src/helper/geom-satellite.cpp
@@ -115,7 +115,7 @@ double arcLengthAt(double const A, Geom::Curve const &curve_in, size_t cache_lim
s = (A * length_part);
} else if (!curve_in.isLineSegment()) {
Geom::Curve *curve = curve_in.portion(0.0, A);
- s = curve->length(0.001);
+ s = curve->length();
}
deque_cache.push_front(std::make_pair(s, std::make_pair(A, d2_in)));
return s;
@@ -261,7 +261,7 @@ void Satellite::setPosition(Geom::Point const p, Geom::Curve const &curve_in, bo
if (!is_time) {
A = arcLengthAt(A, *curve);
}
- this->setAmount(A);
+ amount = A;
}
/**