GCode Processor
GCodeLineEntry.h
Go to the documentation of this file.
1 
4 #ifndef GCode_Line_Entry_h
5 #define GCode_Line_Entry_h
6 
8 struct GCodeLineEntry {
10  short G;
12  double X;
14  double Y;
16  double E;
17 
23  explicit GCodeLineEntry(short g, double x, double y, double e) noexcept :
24  G(g), X(x), Y(y), E(e)
25  {}
26 
28  explicit GCodeLineEntry() = default;
29 
35  static double angle(const GCodeLineEntry& A, const GCodeLineEntry& B, const GCodeLineEntry& C) noexcept;
36 
43  static GCodeLineEntry point_between(const GCodeLineEntry& A, const GCodeLineEntry& B, const double d) noexcept;
44 
51  static double distance(const GCodeLineEntry& A, const GCodeLineEntry& B) noexcept;
52 
53 };
54 
55 #endif
double X
The x coordinate.
Definition: GCodeLineEntry.h:12
Holds the parameter of the extruder read from the input .gcode file.
Definition: GCodeLineEntry.h:8
static double distance(const GCodeLineEntry &A, const GCodeLineEntry &B) noexcept
Angle ABC (in degrees) between two segments (i.e. three points).
Definition: GCodeLineEntry.cpp:14
GCodeLineEntry(short g, double x, double y, double e) noexcept
Constructor.
Definition: GCodeLineEntry.h:23
double E
Length of the filament to extrude.
Definition: GCodeLineEntry.h:16
static GCodeLineEntry point_between(const GCodeLineEntry &A, const GCodeLineEntry &B, const double d) noexcept
Creates a point on the segment AB with a specified distance from the second point.
Definition: GCodeLineEntry.cpp:22
double Y
The y coordinate.
Definition: GCodeLineEntry.h:14
short G
The extruder index.
Definition: GCodeLineEntry.h:10
GCodeLineEntry()=default
Default constructor.
static double angle(const GCodeLineEntry &A, const GCodeLineEntry &B, const GCodeLineEntry &C) noexcept
Distance between the coordinates of two entries.
Definition: GCodeLineEntry.cpp:35