summaryrefslogtreecommitdiffstats
path: root/Project/Line.cpp
diff options
context:
space:
mode:
authorThales1330 <thaleslima.ufu@gmail.com>2016-09-08 18:54:52 -0300
committerThales1330 <thaleslima.ufu@gmail.com>2016-09-08 18:54:52 -0300
commit122d124108384bb4579b6d96956b931d7221d3c1 (patch)
tree72a94cb2d317d37665dac1905d3d3660c48100fb /Project/Line.cpp
parentfb8a409d7e35735afc9d28bfc0d7b49974f0d3a2 (diff)
downloadPSP.git-122d124108384bb4579b6d96956b931d7221d3c1.tar.gz
PSP.git-122d124108384bb4579b6d96956b931d7221d3c1.tar.xz
PSP.git-122d124108384bb4579b6d96956b931d7221d3c1.zip
Fit implemented
Diffstat (limited to 'Project/Line.cpp')
-rw-r--r--Project/Line.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Project/Line.cpp b/Project/Line.cpp
index 0ee9cc8..be805a1 100644
--- a/Project/Line.cpp
+++ b/Project/Line.cpp
@@ -293,3 +293,18 @@ void Line::AddNode(wxPoint2DDouble point)
}
UpdateSwitchesPosition();
}
+
+void Line::CalculateBoundaries(wxPoint2DDouble& leftUp, wxPoint2DDouble& rightBottom) const
+{
+ if(m_pointList.size() > 0) {
+ // Check points list boundaries.
+ leftUp = m_pointList[0];
+ rightBottom = m_pointList[0];
+ for(int i = 1; i < (int)m_pointList.size(); i++) {
+ if(m_pointList[i].m_x < leftUp.m_x) leftUp.m_x = m_pointList[i].m_x;
+ if(m_pointList[i].m_y < leftUp.m_y) leftUp.m_y = m_pointList[i].m_y;
+ if(m_pointList[i].m_x > rightBottom.m_x) rightBottom.m_x = m_pointList[i].m_x;
+ if(m_pointList[i].m_y > rightBottom.m_y) rightBottom.m_y = m_pointList[i].m_y;
+ }
+ }
+}