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

Last change on this file since 1095 was 779, checked in by Maciej Komosinski, 7 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
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
[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;
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.