]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/geometry.h
67c541211fcd93c7655318dc33e6953e6e85fb28
[r2c2.git] / source / libr2c2 / geometry.h
1 #ifndef LIBR2C2_GEOMETRY_H_
2 #define LIBR2C2_GEOMETRY_H_
3
4 #include <cmath>
5 #include <vector>
6
7 namespace R2C2 {
8
9 struct Vector
10 {
11         float x, y, z;
12
13         Vector(): x(0), y(0), z(0) { }
14         Vector(float x_, float y_): x(x_), y(y_), z(0) { }
15         Vector(float x_, float y_, float z_): x(x_), y(y_), z(z_) { }
16 };
17
18 inline float distance(const Vector &p, const Vector &q)
19 { 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)); }
20
21 struct TrackPoint
22 {
23         Vector pos;
24         float dir;
25         float grade;
26
27         TrackPoint(): dir(0), grade(0) { }
28 };
29
30 } // namespace R2C2
31
32 #endif