]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/profile.h
Strip Id tags and copyright notices from files
[r2c2.git] / source / libr2c2 / profile.h
1 #ifndef LIBR2C2_PROFILE_H_
2 #define LIBR2C2_PROFILE_H_
3
4 #include <vector>
5 #include <msp/datafile/objectloader.h>
6 #include "geometry.h"
7
8 namespace R2C2 {
9
10 class Profile
11 {
12 public:
13         class Loader: public Msp::DataFile::ObjectLoader<Profile>
14         {
15         public:
16                 Loader(Profile &);
17         private:
18                 void point(float, float);
19                 void smooth_point(float, float);
20         };
21
22         struct Vertex
23         {
24                 Vector pos;
25                 Vector normal;
26                 bool smooth;
27         };
28
29 private:
30         std::vector<Vertex> vertices;
31         Vector min_coords;
32         Vector max_coords;
33
34 public:
35         void append_vertex(const Vector &, bool);
36         unsigned get_n_vertices() const { return vertices.size(); }
37         const Vertex &get_vertex(unsigned) const;
38         const Vector &get_min_coords() const { return min_coords; }
39         const Vector &get_max_coords() const { return max_coords; }
40         float get_width() const { return max_coords.x-min_coords.x; }
41         float get_height() const { return max_coords.y-min_coords.y; }
42 };
43
44 } // namespace R2C2
45
46 #endif