-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstraightmove.cpp
More file actions
35 lines (28 loc) · 780 Bytes
/
straightmove.cpp
File metadata and controls
35 lines (28 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "straightmove.h"
#include "word.h"
StraightMove::StraightMove(Position from, Position to, double time) :
Move(from, to, time)
{
}
Word*
StraightMove::getCommand(double feed, bool asAbsolute)
{
Word* cmd = new Word('G', 1);
if (feed != DBL_MAX)
{
cmd->addParameter(Word('F', INT_MAX, feed));
}
if (asAbsolute)
{
cmd->addParameter(Word('X', INT_MAX, _end._x));
cmd->addParameter(Word('Y', INT_MAX, _end._y));
cmd->addParameter(Word('Z', INT_MAX, _end._z));
}
else
{
cmd->addParameter(Word('X', INT_MAX, _end._x - _start._x));
cmd->addParameter(Word('Y', INT_MAX, _end._y - _start._y));
cmd->addParameter(Word('Z', INT_MAX, _end._z - _start._z));
}
return cmd;
}