From 8171f4f76e2324c6c3c2b6045195599f63bea762 Mon Sep 17 00:00:00 2001 From: Roman Sorokin Date: Tue, 29 Jul 2014 15:37:47 +0300 Subject: [PATCH] added get-method, improved memory perfomance --- geometry/spline.cpp | 2 +- geometry/spline.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/geometry/spline.cpp b/geometry/spline.cpp index 5771a169c4..05f6a60860 100644 --- a/geometry/spline.cpp +++ b/geometry/spline.cpp @@ -5,7 +5,7 @@ namespace m2 void Spline::FromArray(vector const & path) { - m_position = vector(path.begin(), path.end() - 1); + m_position.assign(path.begin(), path.end() - 1); int cnt = m_position.size(); m_direction = vector(cnt); m_length = vector(cnt); diff --git a/geometry/spline.hpp b/geometry/spline.hpp index 7ca654028c..4f28a673d8 100644 --- a/geometry/spline.hpp +++ b/geometry/spline.hpp @@ -20,7 +20,7 @@ public: : m_spl(NULL), m_index(0), m_dist(0), m_pos(PointF()), m_dir(PointF()), m_avrDir(PointF()), m_checker(false) {} void Attach(Spline const & S); - void Step(float speed); // Speed MUST BE > 0.0f !!! + void Step(float speed); bool beginAgain(); private: bool m_checker; @@ -33,6 +33,7 @@ public: Spline(){} void FromArray(vector const & path); Spline const & operator = (Spline const & spl); + float getLength() { return m_lengthAll; } private: float m_lengthAll;