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:
authorFormerLurker <hochgebe@gmail.com>2020-11-21 03:28:10 +0300
committerFormerLurker <hochgebe@gmail.com>2020-11-21 03:28:10 +0300
commit3eda30c23a6a8f1679989e1862e6c9d815cdbd7e (patch)
tree788203409737a52ba39643cc9c3c69499a02a8bd /ArcWelder
parent66cc88f965f36fca1c07a4dedafad40f19b2825c (diff)
Switch to std namespace for math where possible, implement custom hypot for VS for python 2.7.
Diffstat (limited to 'ArcWelder')
-rw-r--r--ArcWelder/segmented_arc.cpp2
-rw-r--r--ArcWelder/segmented_shape.cpp11
2 files changed, 7 insertions, 6 deletions
diff --git a/ArcWelder/segmented_arc.cpp b/ArcWelder/segmented_arc.cpp
index 5f8701f..de12932 100644
--- a/ArcWelder/segmented_arc.cpp
+++ b/ArcWelder/segmented_arc.cpp
@@ -248,7 +248,7 @@ std::string segmented_arc::get_shape_gcode_(bool has_e, double e, double f) cons
// We may need to add a z coordinate
double z_initial = current_arc_.start_point.z;
double z_final = current_arc_.end_point.z;
- if (!utilities::is_equal(z_initial, z_final, std::pow(10, -1 * xyz_precision_)))
+ if (!utilities::is_equal(z_initial, z_final, std::pow(10.0, -1.0 * xyz_precision_)))
{
// The z axis has changed within the precision of the gcode coordinates
gcode += " Z";
diff --git a/ArcWelder/segmented_shape.cpp b/ArcWelder/segmented_shape.cpp
index 77448c0..76bcca1 100644
--- a/ArcWelder/segmented_shape.cpp
+++ b/ArcWelder/segmented_shape.cpp
@@ -25,6 +25,7 @@
#include "segmented_shape.h"
#include <stdio.h>
+#include "utilities.h"
#include <cmath>
#include <iostream>
#pragma region Operators for Vector and Point
@@ -245,7 +246,7 @@ bool circle::try_create_circle(const array_list<point>& points, const double max
double circle::get_radians(const point& p1, const point& p2) const
{
- double distance_sq = pow(utilities::get_cartesian_distance(p1.x, p1.y, p2.x, p2.y), 2.0);
+ double distance_sq = std::pow(utilities::get_cartesian_distance(p1.x, p1.y, p2.x, p2.y), 2.0);
double two_r_sq = 2.0 * radius * radius;
return acos((two_r_sq - distance_sq) / two_r_sq);
}
@@ -288,7 +289,7 @@ bool circle::is_over_deviation(const array_list<point>& points, const double res
if (z_step_per_distance == 0){
z_step_per_distance = current_z_stepper_distance;
}
- if (!utilities::is_equal(z_step_per_distance, current_z_stepper_distance, std::pow(10, -1.0 * xyz_precision)))
+ if (!utilities::is_equal(z_step_per_distance, current_z_stepper_distance, std::pow(10.0, -1.0 * xyz_precision)))
{
// The z step is uneven, can't create arc
return true;
@@ -387,7 +388,7 @@ bool arc::try_create_arc(
// We may be traveling in 3 space, calculate the arc_length of the spiral
if (start_point.z != end_point.z)
{
- arc_length = std::hypot(arc_length, end_point.z - start_point.z);
+ arc_length = utilities::hypot(arc_length, end_point.z - start_point.z);
}
}
// Calculate the percent difference of the original path
@@ -409,7 +410,7 @@ bool arc::try_create_arc(
// We may be traveling in 3 space, calculate the arc_length of the spiral
if (start_point.z != end_point.z)
{
- test_arc_length = std::hypot(arc_length, end_point.z - start_point.z);
+ test_arc_length = utilities::hypot(arc_length, end_point.z - start_point.z);
}
}
difference = (test_arc_length - approximate_length) / approximate_length;
@@ -425,7 +426,7 @@ bool arc::try_create_arc(
if (allow_z_axis_changes)
{
// Ensure the perimeter of the arc is less than that of a full circle
- double perimeter = std::hypot(c.radius * 2.0 * PI_DOUBLE, end_point.z - start_point.z);
+ double perimeter = utilities::hypot(c.radius * 2.0 * PI_DOUBLE, end_point.z - start_point.z);
if (perimeter <= approximate_length) {
return false;
}