diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-06 18:32:47 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-06 18:32:47 -0300 |
commit | 697baaa3cc92e945d2301238dc9bcabffdb465ef (patch) | |
tree | 01f3de93600a1036c8d693c5c8150434ebf75731 /Project/Machines.cpp | |
parent | d93ef357da510f2515556ff2cb51688a4e068805 (diff) | |
download | PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.tar.gz PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.tar.xz PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.zip |
Counter clockwise rotation implemented
Diffstat (limited to 'Project/Machines.cpp')
-rw-r--r-- | Project/Machines.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Project/Machines.cpp b/Project/Machines.cpp index 29574e6..1b11c68 100644 --- a/Project/Machines.cpp +++ b/Project/Machines.cpp @@ -118,10 +118,13 @@ void Machines::StartMove(wxPoint2DDouble position) m_movePos = m_position; } -void Machines::RotateNode(Element* parent) +void Machines::RotateNode(Element* parent, bool clockwise) { + double rotAngle = m_rotationAngle; + if(!clockwise) rotAngle = -m_rotationAngle; + if(parent == m_parentList[0]) { - m_pointList[0] = parent->RotateAtPosition(m_pointList[0], m_rotationAngle); + m_pointList[0] = parent->RotateAtPosition(m_pointList[0], rotAngle); UpdateSwitchesPosition(); } } @@ -190,9 +193,12 @@ void Machines::UpdateNodes() } } -void Machines::Rotate() +void Machines::Rotate(bool clockwise) { - m_pointList[2] = RotateAtPosition(m_pointList[2], m_rotationAngle); - m_pointList[3] = RotateAtPosition(m_pointList[3], m_rotationAngle); + double rotAngle = m_rotationAngle; + if(!clockwise) rotAngle = -m_rotationAngle; + + m_pointList[2] = RotateAtPosition(m_pointList[2], rotAngle); + m_pointList[3] = RotateAtPosition(m_pointList[3], rotAngle); UpdateSwitchesPosition(); } |