OpenStructure
build-dev-doc
stage
include
ost
gfx
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-2020 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
{
35
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
42
geom::Vec3
position
;
43
float
radius
;
44
Color
color
;
45
};
46
47
typedef
std::vector<SpherePrim>
SpherePrimList
;
48
49
struct
CylinderPrim
{
50
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
97
geom::Vec3
start
,
end
;
98
float
radius1
,
radius2
;
99
Color
color1
,
color2
;
100
float
length
;
101
geom::Mat3
rotmat
;
102
geom::Mat3
rotmat_t
;
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) {}
111
String
str
;
112
geom::Vec3
position
;
113
Color
color
;
114
float
points
;
115
};
116
117
typedef
std::vector<TextPrim>
TextPrimList
;
118
119
120
}}
// ns
121
122
#endif
geom::Mat3
Definition:
mat3.hh:39
geom::Vec3
Three dimensional vector class, using Real precision.
Definition:
vec3.hh:48
ost::gfx::Color
Definition:
color.hh:55
color.hh
geom.hh
String
std::string String
Definition:
base.hh:54
geom
Definition:
aligned_cuboid.hh:29
ost::gfx::TextPrimList
std::vector< TextPrim > TextPrimList
Definition:
gfx_prim.hh:117
ost::gfx::CylinderPrimList
std::vector< CylinderPrim > CylinderPrimList
Definition:
gfx_prim.hh:105
ost::gfx::SpherePrimList
std::vector< SpherePrim > SpherePrimList
Definition:
gfx_prim.hh:47
ost::img::physics::Length
detail::quantity< detail::length_dimension > Length
Definition:
physical_units.hh:88
ost
Definition:
base.dox:1
ost::gfx::CylinderPrim
Definition:
gfx_prim.hh:49
ost::gfx::CylinderPrim::CylinderPrim
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float rad, const Color &col1, const Color &col2)
Definition:
gfx_prim.hh:68
ost::gfx::CylinderPrim::calc_rotmat
void calc_rotmat()
ost::gfx::CylinderPrim::end
geom::Vec3 end
Definition:
gfx_prim.hh:97
ost::gfx::CylinderPrim::radius2
float radius2
Definition:
gfx_prim.hh:98
ost::gfx::CylinderPrim::CylinderPrim
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float radius_1, float radius_2, const Color &col)
Definition:
gfx_prim.hh:77
ost::gfx::CylinderPrim::start
geom::Vec3 start
Definition:
gfx_prim.hh:97
ost::gfx::CylinderPrim::radius1
float radius1
Definition:
gfx_prim.hh:98
ost::gfx::CylinderPrim::length
float length
Definition:
gfx_prim.hh:100
ost::gfx::CylinderPrim::CylinderPrim
CylinderPrim(const geom::Vec3 &st, const geom::Vec3 &en, float rad, const Color &col)
Definition:
gfx_prim.hh:59
ost::gfx::CylinderPrim::color1
Color color1
Definition:
gfx_prim.hh:99
ost::gfx::CylinderPrim::CylinderPrim
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
ost::gfx::CylinderPrim::CylinderPrim
CylinderPrim()
Definition:
gfx_prim.hh:50
ost::gfx::CylinderPrim::rotmat_t
geom::Mat3 rotmat_t
Definition:
gfx_prim.hh:102
ost::gfx::CylinderPrim::rotmat
geom::Mat3 rotmat
Definition:
gfx_prim.hh:101
ost::gfx::CylinderPrim::color2
Color color2
Definition:
gfx_prim.hh:99
ost::gfx::SpherePrim
Definition:
gfx_prim.hh:34
ost::gfx::SpherePrim::SpherePrim
SpherePrim()
Definition:
gfx_prim.hh:35
ost::gfx::SpherePrim::radius
float radius
Definition:
gfx_prim.hh:43
ost::gfx::SpherePrim::color
Color color
Definition:
gfx_prim.hh:44
ost::gfx::SpherePrim::SpherePrim
SpherePrim(const geom::Vec3 &pos, float rad, const Color &col)
Definition:
gfx_prim.hh:38
ost::gfx::SpherePrim::position
geom::Vec3 position
Definition:
gfx_prim.hh:42
ost::gfx::TextPrim
Definition:
gfx_prim.hh:107
ost::gfx::TextPrim::str
String str
Definition:
gfx_prim.hh:111
ost::gfx::TextPrim::TextPrim
TextPrim(const String &s, const geom::Vec3 &p, const Color &c, float ps)
Definition:
gfx_prim.hh:109
ost::gfx::TextPrim::points
float points
Definition:
gfx_prim.hh:114
ost::gfx::TextPrim::TextPrim
TextPrim()
Definition:
gfx_prim.hh:108
ost::gfx::TextPrim::color
Color color
Definition:
gfx_prim.hh:113
ost::gfx::TextPrim::position
geom::Vec3 position
Definition:
gfx_prim.hh:112
Generated by
1.9.1