Initial outline rendering.
[ipdf/code.git] / src / ipdf.h
1 #ifndef _IPDF_H
2 #define _IPDF_H
3
4 #include "common.h"
5
6 namespace IPDF
7 {
8         typedef float Real;
9         
10         inline float RealToFloat(Real r) {return r;}
11         inline Real Random(Real max=1, Real min=0)
12         {
13                 return min + (max-min) * ((Real)(rand() % (int)1e6) / 1e6);
14         }
15
16         typedef unsigned ObjectID;
17
18         struct Rect
19         {
20                 Real x; Real y; Real w; Real h;
21                 Rect() = default; // Needed so we can fread/fwrite this struct
22                 Rect(Real _x, Real _y, Real _w, Real _h) : x(_x), y(_y), w(_w), h(_h) {}
23                 std::string Str() 
24                 {
25                         std::stringstream s;
26                         s << "{" << x << ", " << y << ", " << w << ", " << h << "}";
27                         return s.str();
28                 }
29         };
30
31         struct Objects
32         {
33                 std::vector<Rect> bounds;
34         };
35
36         class View;
37 }
38
39
40 #endif //_IPDF_H

UCC git Repository :: git.ucc.asn.au