summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeter Moulder <peter.moulder@monash.edu>2008-07-04 04:56:42 +0000
committerpjrm <pjrm@users.sourceforge.net>2008-07-04 04:56:42 +0000
commit0c1fbf80797d3f93dbfe0cc71277dcfcac168948 (patch)
treeaa7094d0843b7d477c22a8cb2b74187d2a1e7d96 /src
parentFixed initialization order. (diff)
downloadinkscape-0c1fbf80797d3f93dbfe0cc71277dcfcac168948.tar.gz
inkscape-0c1fbf80797d3f93dbfe0cc71277dcfcac168948.zip
Poly::shifted: simplify to discard mention of handling negative argument value.
(bzr r6145)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/poly.cpp1
-rw-r--r--src/2geom/poly.h29
2 files changed, 8 insertions, 22 deletions
diff --git a/src/2geom/poly.cpp b/src/2geom/poly.cpp
index 5f7663957..1b9b0e568 100644
--- a/src/2geom/poly.cpp
+++ b/src/2geom/poly.cpp
@@ -151,7 +151,6 @@ Poly divide(Poly const &a, Poly const &b, Poly &r) {
c.resize(k, 0.);
for(unsigned i = k; i >= l; i--) {
- assert(i >= 0);
double ci = r.back()/b.back();
c[i-l] += ci;
Poly bb = ci*b;
diff --git a/src/2geom/poly.h b/src/2geom/poly.h
index f76bc3eee..2d7b79bfe 100644
--- a/src/2geom/poly.h
+++ b/src/2geom/poly.h
@@ -92,33 +92,20 @@ public:
assert(result.size() == out_size);
return result;
}
-// equivalent to multiply by x^terms, discard negative terms
- Poly shifted(unsigned terms) const {
+
+ /** Equivalent to multiply by x^terms. */
+ Poly shifted(unsigned const terms) const {
Poly result;
- // This was a no-op and breaks the build on x86_64, as it's trying
- // to take maximum of 32-bit and 64-bit integers
- //const unsigned out_size = std::max(unsigned(0), size()+terms);
- const size_type out_size = size() + terms;
+ size_type const out_size = size() + terms;
result.reserve(out_size);
-// By definition an unsigned can not be less than zero
-// TODO someone who understands the intent needs to correct this properly
-// if(terms < 0) {
-// for(unsigned i = 0; i < out_size; i++) {
-// result.push_back((*this)[i-terms]);
-// }
-// } else {
- for(unsigned i = 0; i < terms; i++) {
- result.push_back(0.0);
- }
- for(unsigned i = 0; i < size(); i++) {
- result.push_back((*this)[i]);
- }
-// }
-
+ result.resize(terms, 0.0);
+ result.insert(result.end(), this->begin(), this->end());
+
assert(result.size() == out_size);
return result;
}
+
Poly operator*(const Poly& p) const;
template <typename T>