source: cpp/frams/genetics/f9/conv_f9.h @ 736

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

Added the new "using_checkpoints" argument to genetic converters so they can now call Model.checkpoint() when desired, see conv_f1.cpp for an example

  • Property svn:eol-style set to native
File size: 1.6 KB
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
[736]2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
[286]3// See LICENSE.txt for details.
[120]4
5#ifndef _CONV_F9_H_
6#define _CONV_F9_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{
[259]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; }
[120]27};
28
29
30// The f9->f0 converter
[259]31class GenoConv_f90 : public GenoConverter
[120]32{
33public:
[139]34        GenoConv_f90();
[120]35
[139]36        //implementation of the GenoConverter method
[736]37        SString convert(SString &in, MultiMap *map, bool using_checkpoints);
[120]38
39protected:
40        //auxiliary methods
[259]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);
[664]44        void setColors(Model &m, int last_added_part); //sets fixed (independent from genes) colors and widths on a model, purely for aesthetic purposes
[125]45        void perturbPartLocations(Model &m); //deterministic "body noise", see APPLY_DETERMINISTIC_BODY_NOISE
[120]46};
47
48#endif
Note: See TracBrowser for help on using the repository browser.