Skip to content

Commit 8bf2296

Browse files
committed
fix minor bug in curve simplification
1 parent 98b8f5a commit 8bf2296

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

include/simplification.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class Subcurve_Shortcut_Graph {
6060
if (Config::verbosity > 1) std::cout << "SIMPL: computing exact minimum error simplification using shortcut graph" << std::endl;
6161
if (ll >= curve.complexity()) return curve;
6262

63-
curve_size_t l = ll - 1;
63+
const curve_size_t l = ll - 1;
6464

6565
Curve result(curve.dimensions());
6666

@@ -103,16 +103,18 @@ class Subcurve_Shortcut_Graph {
103103

104104
if (Config::verbosity > 1) std::cout << "SIMPL: backwards constructing simplification" << std::endl;
105105

106-
curve_size_t ell = l;
106+
curve_size_t ell = l - 1;
107107

108108
result.push_back(curve.back());
109-
curve_size_t predecessor = predecessors[curve.complexity() - 1][--ell];
109+
curve_size_t predecessor = predecessors[curve.complexity() - 1][ell];
110110

111-
for (curve_size_t i = 0; i < l; ++i) {
111+
for (curve_size_t i = 0; i < l - 1; ++i) {
112112
result.push_back(curve[predecessor]);
113113
predecessor = predecessors[predecessor][--ell];
114114
}
115-
115+
116+
result.push_back(curve.front());
117+
116118
std::reverse(result.begin(), result.end());
117119
return result;
118120
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def build_extension(self, ext):
7474

7575
setup(
7676
name='Fred-Frechet',
77-
version='1.9.9',
77+
version='1.9.10',
7878
author='Dennis Rohde',
7979
author_email='[email protected]',
8080
description='A fast, scalable and light-weight C++ Fréchet distance library, exposed to python and focused on (k,l)-clustering of polygonal curves.',

0 commit comments

Comments
 (0)