Changeset 157


Ignore:
Timestamp:
03/01/14 22:38:45 (6 years ago)
Author:
sz
Message:

f9 and Ff converters can now detect an invalid input genotype and react appropriately

Location:
cpp/frams/genetics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/f9/conv_f9.cpp

    r139 r157  
    5252        setColors(m);
    5353        m.close();
     54        if (m.getPartCount() < 2) //only one part <=> there were no valid turtle commands in the input genotype
     55                return ""; //so we return an invalid f0 genotype
    5456        return m.getF0Geno().getGene();
    5557}
     
    5759int GenoConv_f90::addSegment(Model &m,vector<XYZ_LOC> &vertices,const XYZ_LOC &new_vertex,int recently_added)
    5860{
    59         if (vertices.size()<1)
     61        if (vertices.size()<1) //empty model?
    6062        {
    6163                return addNewVertex(m,vertices,new_vertex);
  • cpp/frams/genetics/fF/conv_fF.cpp

    r140 r157  
    1919{
    2020        fF_growth_params gp;
    21         gp.load(in);
     21        if (!gp.load(in)) //invalid input genotype?
     22                return ""; //so we return an invalid f0 genotype
    2223        Model m;
    2324        m.open();
     
    3132        rotation.rotate(Pt3D(0, gp.angle1, gp.angle2)); //assumed rotation around x is 0, which is limiting if we use assymetrical shapes (i.e., not spheres). But the original model had only two angles...
    3233
    33         for (int i = 0; i < gp.number_of_chambers; i++, p1 = p2)
     34        for (int i = 1; i < gp.number_of_chambers; i++, p1 = p2)
    3435        {
    3536                p2 = m.addNewPart(Part::SHAPE_ELLIPSOID);
Note: See TracChangeset for help on using the changeset viewer.