OpenStructure
mapped_property.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_IMPL_MAPPED_PROPERTY_HH
20 #define OST_GFX_IMPL_MAPPED_PROPERTY_HH
21 
22 /*
23  Author: Marco Biasini
24  */
25 
26 #include <ost/mol/entity_view.hh>
27 #include <ost/img/map.hh>
28 
29 #include <ost/gfx/module_config.hh>
30 #include <ost/gfx/gradient.hh>
31 
32 namespace ost { namespace gfx { namespace impl {
33 
34 inline float Normalize(float v, float min_v, float max_v)
35 {
36  return (v-min_v)/(max_v-min_v);
37 }
38 
39 inline float Clamp(float v, float min_v, float max_v)
40 {
41  return std::max(min_v,std::min(max_v,v));
42 }
43 
45  const String& prop,
46  const geom::Vec3& pos);
48  const String& prop,
49  const Gradient& g, float minv, float maxv,
50  const geom::Vec3& pos);
52  const String& prop,
53  const geom::Vec3& pos);
55  const String& prop,
56  const Gradient& g, float minv, float maxv,
57  const geom::Vec3& pos);
58 
59 }}}
60 
61 #endif
Three dimensional vector class, using Real precision.
Definition: vec3.hh:48
color gradient
Definition: gradient.hh:59
Manage shared instances of images.
definition of EntityView
Definition: entity_view.hh:86
#define DLLEXPORT_OST_GFX
std::string String
Definition: base.hh:54
float Clamp(float v, float min_v, float max_v)
float Normalize(float v, float min_v, float max_v)
float DLLEXPORT_OST_GFX MappedProperty(const mol::EntityView &ev, const String &prop, const geom::Vec3 &pos)
Definition: base.dox:1