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-04-26 01:20:39 +0300
committerFormerLurker <hochgebe@gmail.com>2020-04-26 01:20:39 +0300
commit4fcf89d4995921b89b579d06052df11b66e4879f (patch)
tree390bbfcab87591e802f9ac91ac2d531b4ae53946 /ArcWelder/segmented_arc.h
Add project files.
Diffstat (limited to 'ArcWelder/segmented_arc.h')
-rw-r--r--ArcWelder/segmented_arc.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/ArcWelder/segmented_arc.h b/ArcWelder/segmented_arc.h
new file mode 100644
index 0000000..02a8482
--- /dev/null
+++ b/ArcWelder/segmented_arc.h
@@ -0,0 +1,58 @@
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Arc Welder: Anti-Stutter Library
+//
+// Compresses many G0/G1 commands into G2/G3(arc) commands where possible, ensuring the tool paths stay within the specified resolution.
+// This reduces file size and the number of gcodes per second.
+//
+// Uses the 'Gcode Processor Library' for gcode parsing, position processing, logging, and other various functionality.
+//
+// Copyright(C) 2020 - Brad Hochgesang
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// This program is free software : you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published
+// by the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+// GNU Affero General Public License for more details.
+//
+//
+// You can contact the author at the following email address:
+// FormerLurker@pm.me
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#pragma once
+#include "segmented_shape.h"
+#include <iomanip>
+#include <sstream>
+
+#define GCODE_CHAR_BUFFER_SIZE 100
+class segmented_arc :
+ public segmented_shape
+{
+public:
+ segmented_arc();
+ segmented_arc(int max_segments, double resolution_mm);
+ virtual ~segmented_arc();
+ virtual bool try_add_point(point p, double e_relative);
+ virtual std::string get_shape_gcode_absolute(double f, double e_abs_start);
+ virtual std::string get_shape_gcode_relative(double f);
+ virtual bool is_shape();
+ point pop_front(double e_relative);
+ point pop_back(double e_relative);
+ bool try_get_arc(arc & target_arc);
+ // static gcode buffer
+
+private:
+ char gcode_buffer_[GCODE_CHAR_BUFFER_SIZE];
+ bool try_add_point_internal(point p, double pd);
+ bool does_circle_fit_points(circle c, point p, double additional_distance);
+ bool try_get_arc(circle& c, point endpoint, double additional_distance, arc & target_arc);
+ int min_segments_;
+ circle arc_circle_;
+ int test_count_ = 0;
+ std::ostringstream s_stream_;
+};
+