[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. |
---|
[140] | 4 | |
---|
[779] | 5 | #ifndef _FF_CONV_H_ |
---|
| 6 | #define _FF_CONV_H_ |
---|
[140] | 7 | |
---|
[779] | 8 | |
---|
| 9 | |
---|
[176] | 10 | #define fF_TOO_MUCH 0.75 |
---|
| 11 | #define fF_TOO_LITTLE 0.10 |
---|
[174] | 12 | |
---|
[667] | 13 | #define fF_HOLE_RADIUS 0.05 |
---|
[176] | 14 | #define fF_LONGITUDE_NUM 69 |
---|
[174] | 15 | |
---|
[176] | 16 | #define fF_LATITUDE_NUM ((fF_LONGITUDE_NUM - 1)*2) |
---|
| 17 | #define fF_AMOUNT ((fF_LATITUDE_NUM)*(fF_LONGITUDE_NUM)) |
---|
[174] | 18 | |
---|
[176] | 19 | #define fF_THICK_RATIO 0.95 |
---|
[174] | 20 | |
---|
[176] | 21 | #define fF_SIZE fF_LONGITUDE_NUM * fF_LATITUDE_NUM + fF_LATITUDE_NUM |
---|
[174] | 22 | |
---|
[140] | 23 | #include <frams/util/multimap.h> |
---|
| 24 | #include <frams/util/sstring.h> |
---|
| 25 | #include <frams/genetics/genoconv.h> |
---|
[256] | 26 | #include <frams/model/model.h> |
---|
[174] | 27 | #include "fF_chamber3d.h" |
---|
[140] | 28 | |
---|
[178] | 29 | |
---|
| 30 | //A point on the surface of a chamber |
---|
| 31 | struct fF_point |
---|
| 32 | { |
---|
| 33 | double x, y, z; |
---|
| 34 | bool inside; //helper field used when computing whether this point is inside some chamber |
---|
| 35 | }; |
---|
| 36 | |
---|
| 37 | |
---|
[174] | 38 | // The f9->f0 converter |
---|
| 39 | class GenoConv_fF0 : public GenoConverter { |
---|
[140] | 40 | public: |
---|
[176] | 41 | GenoConv_fF0(); |
---|
| 42 | ~GenoConv_fF0(); |
---|
| 43 | //implementation of the GenoConverter method |
---|
[736] | 44 | SString convert(SString &in, MultiMap *map, bool using_checkpoints); |
---|
[140] | 45 | |
---|
| 46 | protected: |
---|
[667] | 47 | void createSphere(int ktora, fF_chamber3d **chambers, double radius0x, double radius0y, double radius0z, double translation, double alpha, double gamma, double kx, double ky, double kz); |
---|
| 48 | fF_point* generate_points(fF_chamber3d *chamber); |
---|
[176] | 49 | double dist(double x1, double y1, double z1, double x2, double y2, double z2); |
---|
[667] | 50 | void search_hid(int nr, fF_chamber3d **spheres); |
---|
| 51 | int find_hole(int which, double x, double y, double z, fF_chamber3d **chambers); |
---|
| 52 | double get_radius(double prev_radius, double scale, double radius0); |
---|
[178] | 53 | private: |
---|
| 54 | double* cosines; |
---|
| 55 | double* sines; |
---|
| 56 | void precompute_cos_and_sin(); |
---|
[256] | 57 | Part *addNewPart(Model *m, const fF_chamber3d* c); |
---|
[140] | 58 | }; |
---|
| 59 | |
---|
[779] | 60 | |
---|
[140] | 61 | #endif |
---|