VPTissue Reference Manual
Size.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "Size.h"
21 
22 #include "bio/Cell.h"
23 #include "util/color/Hsv2Rgb.h"
24 
25 #include <boost/property_tree/ptree.hpp>
26 #include <array>
27 #include <cmath>
28 
29 namespace SimPT_Default {
30 namespace CellColor {
31 
32 using namespace std;
33 using namespace SimPT_Sim::Color;
34 
35 Size::Size(const boost::property_tree::ptree& pt)
36 {
37  m_base = pt.get<double>("cell_mechanics.base_area", 293.893);
38 }
39 
40 array<double, 3> Size::operator()(SimPT_Sim::Cell* cell)
41 {
42  const double x = min(1.0, abs(cell->GetArea() - m_base) / m_base);
43  constexpr double hue = 10.0 / 255.0;
44  constexpr double saturation = 50.0 / 255.0;
45  return Hsv2Rgb(hue, saturation, x);
46 }
47 
48 } // namespace
49 } // namespace
50 
51 
STL namespace.
A cell contains walls and nodes.
Definition: Cell.h:48
std::array< double, 3 > operator()(SimPT_Sim::Cell *cell)
Return color value.
Definition: Size.cpp:40
Namespace for components of the Default model group.
Interface for Cell.
CellColor Size scheme.
Namespace for color utilities.
Definition: hsv.h:27
Rgb color def to Hsv color def: r,g,b values are from 0 to 1 and h = [0,360], s = [0...
Size(const boost::property_tree::ptree &pt)
Straight initialization.
Definition: Size.cpp:35
double GetArea() const
Return the area of the cell.
Definition: Cell.cpp:178