X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Fgeometry.h;h=674a6b9710ec13b640d772e3b37542c9480703c7;hb=6ba6af3637c299ab00828c49de9151429488cc17;hp=e9b9e27266f10d74fb72b87eebd4b327172f97fb;hpb=319f90fd59587efc1242c34f307abc29f323642b;p=r2c2.git diff --git a/source/libmarklin/geometry.h b/source/libmarklin/geometry.h index e9b9e27..674a6b9 100644 --- a/source/libmarklin/geometry.h +++ b/source/libmarklin/geometry.h @@ -1,13 +1,14 @@ /* $Id$ This file is part of the MSP Märklin suite -Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa +Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ #ifndef LIBMARKLIN_GEOMETRY_H_ #define LIBMARKLIN_GEOMETRY_H_ +#include #include namespace Marklin { @@ -21,6 +22,18 @@ struct Point Point(float x_, float y_, float z_): x(x_), y(y_), z(z_) { } }; +inline float distance(const Point &p, const Point &q) +{ return sqrt((p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) + (p.z-q.z)*(p.z-q.z)); } + +struct TrackPoint +{ + Point pos; + float dir; + float grade; + + TrackPoint(): dir(0), grade(0) { } +}; + } // namespace Marklin #endif