Changeset 719 for cpp/frams/genetics/f1
- Timestamp:
- 12/21/17 21:48:17 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f1/conv_f1.cpp
r716 r719 43 43 double model_energy; 44 44 int model_energy_count; 45 void grow(int part1, const char*g, Pt3D k, F1Props c );45 void grow(int part1, const char*g, Pt3D k, F1Props c, int branching_part); 46 46 void setPartMapping(int p, const char* g); 47 47 int growJoint(int part1, int part2, Pt3D &angle, F1Props &c, const char *g); … … 111 111 Builder builder(g, map ? 1 : 0); 112 112 builder.model.open(); 113 builder.grow(-1, g, Pt3D_0, stdprops ); // uses Model::singleStepBuild to create model elements113 builder.grow(-1, g, Pt3D_0, stdprops, -1); // uses Model::singleStepBuild to create model elements 114 114 if (builder.invalid) return SString(); 115 115 builder.addPendingInputs(); … … 133 133 } 134 134 135 void Builder::grow(int part1, const char*g, Pt3D k, F1Props c )135 void Builder::grow(int part1, const char*g, Pt3D k, F1Props c, int branching_part) 136 136 { 137 137 int hasmuscles = 0; … … 141 141 switch (*g) 142 142 { 143 case 0: case ',': case ')': return; 143 case 0: return; 144 case ',': case ')': setPartMapping(branching_part, g); return; 144 145 case 'R': k.x += 0.7853; setPartMapping(part1, g); break; 145 146 case 'r': k.x -= 0.7853; setPartMapping(part1, g); break; … … 241 242 242 243 if (c.muscle_reset_range) c.muscle_bend_range = 1.0; else c.muscle_reset_range = true; 243 grow(part2, g + 1, Pt3D_0, c );244 grow(part2, g + 1, Pt3D_0, c, branching_part); 244 245 return; 245 246 } … … 253 254 c.muscle_bend_range = 1.0 / count; 254 255 for (i = 0; i < count; i++) 255 grow(part1, (char*)ga(i), k + Pt3D(0, 0, -M_PI + (i + 1)*(2 * M_PI / (count + 1))), c );256 grow(part1, (char*)ga(i), k + Pt3D(0, 0, -M_PI + (i + 1)*(2 * M_PI / (count + 1))), c, part1); 256 257 return; 257 258 }
Note: See TracChangeset
for help on using the changeset viewer.