From 657f73321f04d5d1c4cec8085ec43a73633b96af Mon Sep 17 00:00:00 2001 From: Arnur Nigmetov Date: Thu, 21 Jun 2018 21:43:29 +0200 Subject: Bug in longest edge for negative persistence fixed --- geom_bottleneck/include/basic_defs_bt.h | 2 +- geom_bottleneck/tests/data/test_008_A | 1 + geom_bottleneck/tests/data/test_008_B | 1 + geom_bottleneck/tests/data/test_009_A | 1 + geom_bottleneck/tests/data/test_009_B | 1 + geom_bottleneck/tests/data/test_list.txt | 2 ++ 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/geom_bottleneck/include/basic_defs_bt.h b/geom_bottleneck/include/basic_defs_bt.h index 6124dbe..172e0f7 100644 --- a/geom_bottleneck/include/basic_defs_bt.h +++ b/geom_bottleneck/include/basic_defs_bt.h @@ -194,7 +194,7 @@ namespace hera { { if (isDiagonal()) return 0.0; - Real pers = (y - x) / 2; + Real pers = fabs(y - x) / 2; if (internal_p == get_infinity()) { return pers; } else if (internal_p == 1.0) { diff --git a/geom_bottleneck/tests/data/test_008_A b/geom_bottleneck/tests/data/test_008_A index e69de29..50b3df6 100644 --- a/geom_bottleneck/tests/data/test_008_A +++ b/geom_bottleneck/tests/data/test_008_A @@ -0,0 +1 @@ +0 1.1 diff --git a/geom_bottleneck/tests/data/test_008_B b/geom_bottleneck/tests/data/test_008_B index e69de29..1935b11 100644 --- a/geom_bottleneck/tests/data/test_008_B +++ b/geom_bottleneck/tests/data/test_008_B @@ -0,0 +1 @@ +0 0.1 diff --git a/geom_bottleneck/tests/data/test_009_A b/geom_bottleneck/tests/data/test_009_A index e69de29..a1b859e 100644 --- a/geom_bottleneck/tests/data/test_009_A +++ b/geom_bottleneck/tests/data/test_009_A @@ -0,0 +1 @@ +1.1 0 diff --git a/geom_bottleneck/tests/data/test_009_B b/geom_bottleneck/tests/data/test_009_B index e69de29..b5befbc 100644 --- a/geom_bottleneck/tests/data/test_009_B +++ b/geom_bottleneck/tests/data/test_009_B @@ -0,0 +1 @@ +0.1 0 diff --git a/geom_bottleneck/tests/data/test_list.txt b/geom_bottleneck/tests/data/test_list.txt index 1309884..24b462a 100644 --- a/geom_bottleneck/tests/data/test_list.txt +++ b/geom_bottleneck/tests/data/test_list.txt @@ -3,6 +3,8 @@ test_002_A test_002_B 0.01 0.2 0 0 test_003_A test_003_B 0.01 2 1 1 test_004_A test_004_B 0.01 inf -1 -1 test_005_A test_005_B 0.01 4 5 5 +test_008_A test_008_B 0.01 0.55 0 -1 +test_009_A test_009_B 0.01 0.55 0 -1 test_010_A test_010_B 0.01 1.32937 test_011_A test_011_B 0.01 1.03125 test_014_A test_014_B 0.01 0 -- cgit v1.2.3