Changeset 256
- Timestamp:
- 11/18/14 17:04:37 (10 years ago)
- Location:
- cpp/frams/genetics/fF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/fF/conv_fF.cpp
r197 r256 5 5 #include "conv_fF.h" 6 6 #include "fF_genotype.h" 7 #include <frams/model/model.h>8 7 #include <common/nonstd_stl.h> 9 8 #include <common/Convert.h> … … 26 25 } 27 26 27 Part *GenoConv_fF0::addNewPart(Model *m, const fF_chamber3d* c) 28 { 29 Part *part = m->addNewPart(Part::SHAPE_ELLIPSOID); 30 part->p = Pt3D(c->centerX, c->centerY, c->centerZ); 31 Pt3D hole = Pt3D(c->holeX, c->holeY, c->holeZ); 32 Orient o; 33 o.lookAt(part->p - hole); 34 part->setOrient(o); 35 return part; 36 } 37 28 38 SString GenoConv_fF0::convert(SString &in, MultiMap *map) 29 39 { … … 40 50 m.vis_style = "foram"; //dedicated visual look for Foraminifera 41 51 42 // subsequent parts (chambers) are placed relative to the previous part's orientation and location43 Part *p1, *p2;44 45 52 fF_chamber3d **chambers = new fF_chamber3d*[gp.number_of_chambers]; 46 47 53 for (int i = 0; i < gp.number_of_chambers; i++) 48 54 createSphere(i, chambers, radius, div_radius_length, gp.translation, gp.angle1, gp.angle2, gp.scalex, gp.scaley, gp.scalez); 49 55 50 p1 = m.addNewPart(Part::SHAPE_ELLIPSOID); 51 p1->p = Pt3D(chambers[0]->centerX, chambers[0]->centerY, chambers[0]->centerZ); 52 53 54 for (int i = 1; i < gp.number_of_chambers; i++, p1 = p2) 55 { 56 p2 = m.addNewPart(Part::SHAPE_ELLIPSOID); 56 Part *p1 = addNewPart(&m, chambers[0]); 57 for (int i = 1; i < gp.number_of_chambers; i++) 58 { 59 Part *p2 = addNewPart(&m, chambers[i]); 57 60 p2->scale = p1->scale.entrywiseProduct(Pt3D(gp.scalex, gp.scaley, gp.scalez)); //each part's scale is its predecessor's scale * scaling 58 59 p2->p = Pt3D(chambers[i]->centerX, chambers[i]->centerY, chambers[i]->centerZ);60 61 61 m.addNewJoint(p1, p2, Joint::SHAPE_SOLID); //all parts must be connected 62 p1 = p2; 62 63 } 63 64 64 65 for (int i = 0; i < gp.number_of_chambers; i++) 65 66 delete chambers[i]; 66 delete[] chambers;67 delete[] chambers; 67 68 68 69 m.close(); … … 87 88 if (radius < fF_TOO_LITTLE) { 88 89 radius = fF_TOO_LITTLE; 89 if (fabs(len) > (fF_TOO_MUCH * radius)) {90 if (fabs(len) > (fF_TOO_MUCH * radius)) { 90 91 len = ((len < 0) ? (-1) : 1) * fF_TOO_MUCH * radius; 91 92 } -
cpp/frams/genetics/fF/conv_fF.h
r197 r256 22 22 #include <frams/util/sstring.h> 23 23 #include <frams/genetics/genoconv.h> 24 #include <frams/model/model.h> 24 25 #include "fF_chamber3d.h" 25 26 … … 53 54 double* sines; 54 55 void precompute_cos_and_sin(); 56 Part *addNewPart(Model *m, const fF_chamber3d* c); 55 57 }; 56 58
Note: See TracChangeset
for help on using the changeset viewer.