OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
gfx_prim.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GFX_PRIM_HH
20 #define OST_GFX_PRIM_HH
21 
22 /*
23  Author: Ansgar Philippsen
24 */
25 
26 #include <vector>
27 
28 #include <ost/geom/geom.hh>
29 
30 #include "color.hh"
31 
32 namespace ost { namespace gfx {
33 
34 struct SpherePrim {
36  position(),radius(1.0),color()
37  {}
38  SpherePrim(const geom::Vec3& pos, float rad, const Color& col):
39  position(pos), radius(rad), color(col)
40  {}
41 
43  float radius;
45 };
46 
47 typedef std::vector<SpherePrim> SpherePrimList;
48 
49 struct CylinderPrim {
51  start(), end(),
52  radius1(1.0), radius2(1.0),
53  color1(), color2(),
54  length(1.0), rotmat(), rotmat_t()
55  {
56  calc_rotmat();
57  }
58 
59  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float rad, const Color& col):
60  start(st), end(en),
61  radius1(rad), radius2(rad),
62  color1(col), color2(col),
63  length(geom::Length(end-start)), rotmat(), rotmat_t()
64  {
65  calc_rotmat();
66  }
67 
68  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float rad, const Color& col1, const Color& col2):
69  start(st), end(en),
70  radius1(rad), radius2(rad),
71  color1(col1), color2(col2),
72  length(geom::Length(end-start)), rotmat(), rotmat_t()
73  {
74  calc_rotmat();
75  }
76 
77  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float radius_1, float radius_2, const Color& col):
78  start(st), end(en),
79  radius1(radius_1), radius2(radius_2),
80  color1(col), color2(col),
81  length(geom::Length(end-start)), rotmat(), rotmat_t()
82  {
83  calc_rotmat();
84  }
85 
86  CylinderPrim(const geom::Vec3& st, const geom::Vec3& en, float radius_1, float radius_2, const Color& col1, const Color& col2):
87  start(st), end(en),
88  radius1(radius_1), radius2(radius_2),
89  color1(col1), color2(col2),
90  length(geom::Length(end-start)), rotmat(), rotmat_t()
91  {
92  calc_rotmat();
93  }
94 
95  void calc_rotmat();
96 
100  float length;
103 };
104 
105 typedef std::vector<CylinderPrim> CylinderPrimList;
106 
107 struct TextPrim {
108  TextPrim(): str(""), position(),color(),points(1.0) {}
109  TextPrim(const String& s, const geom::Vec3& p, const Color& c, float ps):
110  str(s), position(p), color(c), points(ps) {}
114  float points;
115 };
116 
117 typedef std::vector<TextPrim> TextPrimList;
118 
119 
120 }} // ns
121 
122 #endif
SpherePrim(const geom::Vec3 &pos, float rad, const Color &col)
Definition: gfx_prim.hh:38
std::vector< CylinderPrim > CylinderPrimList
Definition: gfx_prim.hh:105
geom::Vec3 position
Definition: gfx_prim.hh:42
std::string String
Definition: base.hh:54
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float rad, const Color &col1, const Color &col2)
Definition: gfx_prim.hh:68
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float rad, const Color &col)
Definition: gfx_prim.hh:59
geom::Vec3 position
Definition: gfx_prim.hh:112
TextPrim(const String &s, const geom::Vec3 &p, const Color &c, float ps)
Definition: gfx_prim.hh:109
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float radius_1, float radius_2, const Color &col)
Definition: gfx_prim.hh:77
Three dimensional vector class, using Real precision.
Definition: vec3.hh:42
detail::quantity< detail::length_dimension > Length
std::vector< TextPrim > TextPrimList
Definition: gfx_prim.hh:117
std::vector< SpherePrim > SpherePrimList
Definition: gfx_prim.hh:47
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float radius_1, float radius_2, const Color &col1, const Color &col2)
Definition: gfx_prim.hh:86