1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
2 | // Copyright (C) 1999-2018 Maciej Komosinski and Szymon Ulatowski. |
---|
3 | // See LICENSE.txt for details. |
---|
4 | |
---|
5 | #ifndef _FF_CONV_H_ |
---|
6 | #define _FF_CONV_H_ |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | #define fF_TOO_MUCH 0.75 |
---|
11 | #define fF_TOO_LITTLE 0.10 |
---|
12 | |
---|
13 | #define fF_HOLE_RADIUS 0.05 |
---|
14 | #define fF_LONGITUDE_NUM 69 |
---|
15 | |
---|
16 | #define fF_LATITUDE_NUM ((fF_LONGITUDE_NUM - 1)*2) |
---|
17 | #define fF_AMOUNT ((fF_LATITUDE_NUM)*(fF_LONGITUDE_NUM)) |
---|
18 | |
---|
19 | #define fF_THICK_RATIO 0.95 |
---|
20 | |
---|
21 | #define fF_SIZE fF_LONGITUDE_NUM * fF_LATITUDE_NUM + fF_LATITUDE_NUM |
---|
22 | |
---|
23 | #include <frams/util/multimap.h> |
---|
24 | #include <frams/util/sstring.h> |
---|
25 | #include <frams/genetics/genoconv.h> |
---|
26 | #include <frams/model/model.h> |
---|
27 | #include "fF_chamber3d.h" |
---|
28 | |
---|
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 | |
---|
38 | // The f9->f0 converter |
---|
39 | class GenoConv_fF0 : public GenoConverter { |
---|
40 | public: |
---|
41 | GenoConv_fF0(); |
---|
42 | ~GenoConv_fF0(); |
---|
43 | //implementation of the GenoConverter method |
---|
44 | SString convert(SString &in, MultiMap *map, bool using_checkpoints); |
---|
45 | |
---|
46 | protected: |
---|
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); |
---|
49 | double dist(double x1, double y1, double z1, double x2, double y2, double z2); |
---|
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); |
---|
53 | private: |
---|
54 | double* cosines; |
---|
55 | double* sines; |
---|
56 | void precompute_cos_and_sin(); |
---|
57 | Part *addNewPart(Model *m, const fF_chamber3d* c); |
---|
58 | }; |
---|
59 | |
---|
60 | |
---|
61 | #endif |
---|