]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/profile.cpp
Rename the project to R²C²
[r2c2.git] / source / libmarklin / profile.cpp
diff --git a/source/libmarklin/profile.cpp b/source/libmarklin/profile.cpp
deleted file mode 100644 (file)
index 7b9dce5..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* $Id$
-
-This file is part of the MSP Märklin suite
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
-#include <cmath>
-#include "profile.h"
-
-using namespace std;
-using namespace Msp;
-
-namespace Marklin {
-
-void Profile::append_point(const Point &p)
-{
-       points.push_back(p);
-       if(points.size()==1)
-       {
-               min_coords = p;
-               max_coords = p;
-       }
-       else
-       {
-               min_coords.x = min(min_coords.x, p.x);
-               min_coords.y = min(min_coords.y, p.y);
-               max_coords.x = max(max_coords.x, p.x);
-               max_coords.y = max(max_coords.y, p.y);
-       }
-}
-
-const Point &Profile::get_point(unsigned i) const
-{
-       if(i>=points.size())
-               throw InvalidParameterValue("Index out of range");
-       return points[i];
-}
-
-Point Profile::get_edge_normal(unsigned i) const
-{
-       if(i+1>=points.size())
-               throw InvalidParameterValue("Index out of range");
-       float dx = points[i+1].x-points[i].x;
-       float dy = points[i+1].y-points[i].y;
-       float len = sqrt(dx*dx+dy*dy);
-       return Point(dy/len, -dx/len);
-}
-
-
-Profile::Loader::Loader(Profile &p):
-       DataFile::ObjectLoader<Profile>(p)
-{
-       add("point", &Loader::point);
-}
-
-void Profile::Loader::point(float x, float y)
-{
-       obj.append_point(Point(x/1000, y/1000));
-}
-
-} // namespace Marklin