| 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
|---|
| 2 | // Copyright (C) 1999-2017 Maciej Komosinski and Szymon Ulatowski. |
|---|
| 3 | // See LICENSE.txt for details. |
|---|
| 4 | |
|---|
| 5 | #ifndef _CONV_FF_H_ |
|---|
| 6 | #define _CONV_FF_H_ |
|---|
| 7 | |
|---|
| 8 | #define fF_TOO_MUCH 0.75 |
|---|
| 9 | #define fF_TOO_LITTLE 0.10 |
|---|
| 10 | |
|---|
| 11 | #define fF_HOLE_RADIUS 0.05 |
|---|
| 12 | #define fF_LONGITUDE_NUM 69 |
|---|
| 13 | |
|---|
| 14 | #define fF_LATITUDE_NUM ((fF_LONGITUDE_NUM - 1)*2) |
|---|
| 15 | #define fF_AMOUNT ((fF_LATITUDE_NUM)*(fF_LONGITUDE_NUM)) |
|---|
| 16 | |
|---|
| 17 | #define fF_THICK_RATIO 0.95 |
|---|
| 18 | |
|---|
| 19 | #define fF_SIZE fF_LONGITUDE_NUM * fF_LATITUDE_NUM + fF_LATITUDE_NUM |
|---|
| 20 | |
|---|
| 21 | #include <frams/util/multimap.h> |
|---|
| 22 | #include <frams/util/sstring.h> |
|---|
| 23 | #include <frams/genetics/genoconv.h> |
|---|
| 24 | #include <frams/model/model.h> |
|---|
| 25 | #include "fF_chamber3d.h" |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | //A point on the surface of a chamber |
|---|
| 29 | struct fF_point |
|---|
| 30 | { |
|---|
| 31 | double x, y, z; |
|---|
| 32 | bool inside; //helper field used when computing whether this point is inside some chamber |
|---|
| 33 | }; |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | // The f9->f0 converter |
|---|
| 37 | class GenoConv_fF0 : public GenoConverter { |
|---|
| 38 | public: |
|---|
| 39 | GenoConv_fF0(); |
|---|
| 40 | ~GenoConv_fF0(); |
|---|
| 41 | //implementation of the GenoConverter method |
|---|
| 42 | SString convert(SString &in, MultiMap *map); |
|---|
| 43 | |
|---|
| 44 | protected: |
|---|
| 45 | 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); |
|---|
| 46 | fF_point* generate_points(fF_chamber3d *chamber); |
|---|
| 47 | double dist(double x1, double y1, double z1, double x2, double y2, double z2); |
|---|
| 48 | void search_hid(int nr, fF_chamber3d **spheres); |
|---|
| 49 | int find_hole(int which, double x, double y, double z, fF_chamber3d **chambers); |
|---|
| 50 | double get_radius(double prev_radius, double scale, double radius0); |
|---|
| 51 | private: |
|---|
| 52 | double* cosines; |
|---|
| 53 | double* sines; |
|---|
| 54 | void precompute_cos_and_sin(); |
|---|
| 55 | Part *addNewPart(Model *m, const fF_chamber3d* c); |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | #endif |
|---|