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

Last change on this file since 1304 was 1157, checked in by Maciej Komosinski, 3 years ago

Improved f9 mutation

  • Property svn:eol-style set to native
File size: 1.7 KB
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
[1157]2// Copyright (C) 1999-2021  Maciej Komosinski and Szymon Ulatowski.
[286]3// See LICENSE.txt for details.
[120]4
[779]5#ifndef _F9_CONV_H_
6#define _F9_CONV_H_
[120]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;
[1157]19extern int turtle_commands_f9_count;
[120]20
21
22struct XYZ_LOC
23{
[259]24        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
25        XYZ_LOC() { x = y = z = 0; }
26        void add(int delta[3]) { x += delta[0]; y += delta[1]; z += delta[2]; }
27        bool same_coordinates(const XYZ_LOC &loc) { return x == loc.x && y == loc.y && z == loc.z; }
[120]28};
29
30
31// The f9->f0 converter
[259]32class GenoConv_f90 : public GenoConverter
[120]33{
34public:
[139]35        GenoConv_f90();
[120]36
[139]37        //implementation of the GenoConverter method
[736]38        SString convert(SString &in, MultiMap *map, bool using_checkpoints);
[120]39
40protected:
41        //auxiliary methods
[259]42        int addSegment(Model &m, int genenr, vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex, int recently_added);
43        int findVertexAt(vector<XYZ_LOC> &vertices, const XYZ_LOC &new_vertex);
44        int addNewVertex(Model &m, vector<XYZ_LOC> &punkty, const XYZ_LOC &nowypunkt);
[664]45        void setColors(Model &m, int last_added_part); //sets fixed (independent from genes) colors and widths on a model, purely for aesthetic purposes
[125]46        void perturbPartLocations(Model &m); //deterministic "body noise", see APPLY_DETERMINISTIC_BODY_NOISE
[120]47};
48
49#endif
Note: See TracBrowser for help on using the repository browser.