Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FormerLurker/ArcWelderLib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ArcWelder/segmented_shape.cpp')
-rw-r--r--ArcWelder/segmented_shape.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/ArcWelder/segmented_shape.cpp b/ArcWelder/segmented_shape.cpp
index ec0611e..4e17d3c 100644
--- a/ArcWelder/segmented_shape.cpp
+++ b/ArcWelder/segmented_shape.cpp
@@ -447,8 +447,8 @@ bool arc::try_create_arc(
}
}
// Calculate the percent difference of the original path
- double difference = (arc_length - approximate_length) / approximate_length;
- if (!utilities::is_zero(difference, path_tolerance_percent))
+ double path_difference_percent = utilities::get_percent_change(arc_length, approximate_length);
+ if (!utilities::is_zero(path_difference_percent, path_tolerance_percent))
{
// So it's possible our vector calculation above got the direction wrong.
// This can happen if there is a crazy arrangement of points
@@ -468,8 +468,8 @@ bool arc::try_create_arc(
test_arc_length = utilities::hypot(test_arc_length, end_point.z - start_point.z);
}
}
- difference = (test_arc_length - approximate_length) / approximate_length;
- if (!utilities::is_zero(difference, path_tolerance_percent))
+ path_difference_percent = utilities::get_percent_change(test_arc_length,approximate_length);
+ if (!utilities::is_zero(path_difference_percent, path_tolerance_percent))
{
return false;
}