Skip to content

Commit

Permalink
fix minor bug in curve simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
derohde committed Apr 29, 2022
1 parent 98b8f5a commit 8bf2296
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions include/simplification.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Subcurve_Shortcut_Graph {
if (Config::verbosity > 1) std::cout << "SIMPL: computing exact minimum error simplification using shortcut graph" << std::endl;
if (ll >= curve.complexity()) return curve;

curve_size_t l = ll - 1;
const curve_size_t l = ll - 1;

Curve result(curve.dimensions());

Expand Down Expand Up @@ -103,16 +103,18 @@ class Subcurve_Shortcut_Graph {

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

curve_size_t ell = l;
curve_size_t ell = l - 1;

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

for (curve_size_t i = 0; i < l; ++i) {
for (curve_size_t i = 0; i < l - 1; ++i) {
result.push_back(curve[predecessor]);
predecessor = predecessors[predecessor][--ell];
}


result.push_back(curve.front());

std::reverse(result.begin(), result.end());
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def build_extension(self, ext):

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

0 comments on commit 8bf2296

Please sign in to comment.