source: cpp/frams/genetics/fF/fF_genotype.h @ 140

Last change on this file since 140 was 140, checked in by sz, 10 years ago

introducing the Foraminifera encoding (format 'F')

  • Property svn:eol-style set to native
File size: 990 bytes
Line 
1// This file is a part of the Framsticks GDK.
2// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#ifndef _FF_GENOTYPE_H_
6#define _FF_GENOTYPE_H_
7
8#include <stdio.h>
9#include "common/stl-util.h"
10
11
12struct fF_growth_params
13{
14        int number_of_chambers;
15        double scalex, scaley, scalez; //scaling factors
16        double translation; //translation factor, TF range [−1; 1]
17        double angle1, angle2;
18
19        fF_growth_params()
20        {
21                reset();
22        }
23
24        void reset()
25        {
26                number_of_chambers = 1;
27                scalex = scaley = scalez = 1;
28                translation = 1;
29                angle1 = angle2 = 0;
30        }
31
32        bool load(const char* serialized)
33        {
34                return sscanf(serialized, "%d %lf %lf %lf %lf %lf %lf", &number_of_chambers, &scalex, &scaley, &scalez, &translation, &angle1, &angle2) == 7;
35        }
36
37        string save()
38        {
39                return ssprintf("%d %f %f %f %f %f %f", number_of_chambers, scalex, scaley, scalez, translation, angle1, angle2);
40        }
41};
42
43
44#endif
Note: See TracBrowser for help on using the repository browser.