source: cpp/frams/genetics/f9/f9_conv.h @ 899

Last change on this file since 899 was 779, checked in by Maciej Komosinski, 6 years ago

Unified file names of all files involved in genetic conversions and operations so that they start with "f<format>_"

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#ifndef _F9_CONV_H_
6#define _F9_CONV_H_
7
8#include <ctype.h>
9#include <common/nonstd_math.h>
10#include <frams/model/modelparts.h>
11#include <frams/util/multimap.h>
12#include <frams/util/sstring.h>
13#include <frams/genetics/genoconv.h>
14#include <vector>
15using std::vector;
16
17
18extern const char* turtle_commands_f9;
19
20
21struct XYZ_LOC
22{
23        int x, y, z; //coordinates xyz of a vertex - represented as int's so that it is easy and safe to check identity. Could also be done using lists of Model's Parts, but that would involve comparing floats
24        XYZ_LOC() { x = y = z = 0; }
25        void add(int delta[3]) { x += delta[0]; y += delta[1]; z += delta[2]; }
26        bool same_coordinates(const XYZ_LOC &loc) { return x == loc.x && y == loc.y && z == loc.z; }
27};
28
29
30// The f9->f0 converter
31class GenoConv_f90 : public GenoConverter
32{
33public:
34        GenoConv_f90();
35
36        //implementation of the GenoConverter method
37        SString convert(SString &in, MultiMap *map, bool using_checkpoints);
38
39protected:
40        //auxiliary methods
41        int addSegment(Model &m, int genenr, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex, int recently_added);
42        int findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex);
43        int addNewVertex(Model &m, vector<XYZ_LOC> &punkty, const XYZ_LOC &nowypunkt);
44        void setColors(Model &m, int last_added_part); //sets fixed (independent from genes) colors and widths on a model, purely for aesthetic purposes
45        void perturbPartLocations(Model &m); //deterministic "body noise", see APPLY_DETERMINISTIC_BODY_NOISE
46};
47
48#endif
Note: See TracBrowser for help on using the repository browser.