Changeset 1302
- Timestamp:
- 04/25/24 21:59:54 (8 months ago)
- Location:
- cpp
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/nonstd_math.h
r1298 r1302 25 25 inline double rndDouble(double limit_exclusive) { return rndGetInstance().getDouble() * limit_exclusive; } 26 26 inline unsigned int rndUint(unsigned int limit_exclusive) { return (unsigned int)(rndGetInstance().getDouble() * limit_exclusive); } //returns random from 0..limit_exclusive-1 27 #ifndef __BORLANDC__ //for embarcadero 11u3, unsigned int and size_t are duplicates 27 28 inline unsigned int rndUint(size_t limit_exclusive) {return rndUint((unsigned int)limit_exclusive);} //just an overload with size_t argument 29 #endif 28 30 unsigned int rndUint(int limit_exclusive); //just an overload with int argument 29 31 inline void rndSetSeed(unsigned int seed) { rndGetInstance().setSeed(seed); } -
cpp/frams/_demos/geneprops_graph.py
r1242 r1302 43 43 segs.append( ((len(n[0]),n[1]),(len(n[0])+1,child[1])) ) 44 44 45 linecol = LineCollection(segs, linewidths=2, linestyle='solid' )45 linecol = LineCollection(segs, linewidths=2, linestyle='solid', color='#ddddff') 46 46 ax.add_collection(linecol) 47 47 … … 55 55 56 56 ax.xaxis.set_visible(False) 57 plt.tight_layout() 57 58 plt.show() -
cpp/frams/_demos/geneprops_test.cpp
r1260 r1302 10 10 Examples: 11 11 12 - new experimental friction:12 - experimental exponential friction: 13 13 $ ./geneprops_test f 3 -e | sort -n -k 2 14 14 … … 94 94 case 'e': fun = ExperimentalExponential; break; 95 95 case 'h': printf("%s args: [modifier [max_count]] (one of " F14_MODIFIERS ")\n" 96 "\t-l = legacy function\n"96 "\t-l = legacy\n" 97 97 "\t-n = modern, change=0.5, normalizeBiol4 disabled\n" 98 "\t-e = experimental exponential function\n", argv[0]);98 "\t-e = experimental exponential\n", argv[0]); 99 99 return 0; 100 100 default: fprintf(stderr, "%s: invalid option: %s\n", argv[0], arg); return 2; -
cpp/frams/genetics/f1/f1_conv.cpp
r1258 r1302 23 23 "- Full/NumberOfBranches - a compromise between the two other settings.\n" 24 24 "- Full/(NumberOfBranches+1) - because the originating stick also counts as a branch. This setting guarantees that in the worst case, when at least two neighboring branches have sticks controlled by bending muscles and their controlling signals are at extreme values, the sticks can touch and overlap, but will not intersect. This setting is in most cases too strict because (1) all branches are very rarely controlled by muscles, (2) there are often 'empty' branches - multiple commas with no sticks in-between, and (3) the share of the originating stick is effectively wasted because this stick itself has no muscle at the branching point so it will not bend; the muscle bending range is symmetrical and the default range is equal for all muscles in a branching, but the sticks equipped with muscles in a branching are rarely evenly spaced.\n" 25 "- Full: Always 1 (the complete angle)- because we do not have to care about the physical plausibility and avoid intersecting sticks, and other genetic representations do not impose such constraints, so this full angle setting can be useful as the default bending range when comparing the performance of various genetic encodings."},25 "- Full: always the complete angle - because we do not have to care about the physical plausibility and avoid intersecting sticks, and other genetic representations do not impose such constraints, so this full angle setting can be useful as the default bending range when comparing the performance of various genetic encodings."}, 26 26 27 27 { 0, }, … … 331 331 { 332 332 double len = std::min(2.0, c.length); 333 Part *p1 = model.getPart(part1); 334 Part *p2 = model.getPart(part2); 333 335 sprintf(tmp, "p1=%d,p2=%d,dx=%lg,rx=%lg,ry=%lg,rz=%lg,stam=%lg,vr=%g,vg=%g,vb=%g", 334 part1, part2, len, angle.x, angle.y, angle.z, c.stamina, c.cred, c.cgreen, c.cblue);336 part1, part2, len, angle.x, angle.y, angle.z, c.stamina, (p1->vcolor.x+p2->vcolor.x)/2, (p1->vcolor.y+p2->vcolor.y)/2, (p1->vcolor.z+p2->vcolor.z)/2); 335 337 lastjoint_muscle_power = c.muscle_power; 336 338 return model.addFromString(Model::JointType, tmp, makeRange(g)); -
cpp/frams/model/modelparts.h
r1280 r1302 103 103 }; 104 104 static const char* getShapeName(Shape sh); 105 static constexpr double DEFAULT_STICK_RADIUS = 0. 2; //used in SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion105 static constexpr double DEFAULT_STICK_RADIUS = 0.15; //used in odesim and in SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion 106 106 107 107 double mass, size, density, friction, ingest, assim, hollow; -
cpp/frams/param/param.cpp
r1278 r1302 104 104 } 105 105 106 int ParamInterface::getMinMaxInt(int prop, paInt& min umum, paInt& maximum, paInt &def)107 { 108 return getMinMaxIntFromTypeDef(type(prop), min umum, maximum, def);109 } 110 111 int ParamInterface::getMinMaxDouble(int prop, double& min umum, double& maximum, double& def)112 { 113 return getMinMaxDoubleFromTypeDef(type(prop), min umum, maximum, def);114 } 115 116 int ParamInterface::getMinMaxString(int prop, int& min umum, int& maximum, SString& def)117 { 118 return getMinMaxStringFromTypeDef(type(prop), min umum, maximum, def);119 } 120 121 int ParamInterface::getMinMaxIntFromTypeDef(const char* t, paInt& min umum, paInt& maximum, paInt &def)106 int ParamInterface::getMinMaxInt(int prop, paInt& minimum, paInt& maximum, paInt &def) 107 { 108 return getMinMaxIntFromTypeDef(type(prop), minimum, maximum, def); 109 } 110 111 int ParamInterface::getMinMaxDouble(int prop, double& minimum, double& maximum, double& def) 112 { 113 return getMinMaxDoubleFromTypeDef(type(prop), minimum, maximum, def); 114 } 115 116 int ParamInterface::getMinMaxString(int prop, int& minimum, int& maximum, SString& def) 117 { 118 return getMinMaxStringFromTypeDef(type(prop), minimum, maximum, def); 119 } 120 121 int ParamInterface::getMinMaxIntFromTypeDef(const char* t, paInt& minimum, paInt& maximum, paInt &def) 122 122 { 123 123 while (*t) if (*t == ' ') break; else t++; 124 return sscanf(t, PA_INT_SCANF " " PA_INT_SCANF " " PA_INT_SCANF, &min umum, &maximum, &def);125 } 126 127 int ParamInterface::getMinMaxDoubleFromTypeDef(const char* t, double& min umum, double& maximum, double& def)124 return sscanf(t, PA_INT_SCANF " " PA_INT_SCANF " " PA_INT_SCANF, &minimum, &maximum, &def); 125 } 126 127 int ParamInterface::getMinMaxDoubleFromTypeDef(const char* t, double& minimum, double& maximum, double& def) 128 128 { 129 129 while (*t) if (*t == ' ') break; else t++; 130 return sscanf(t, "%l g %lg %lg", &minumum, &maximum, &def);131 } 132 133 int ParamInterface::getMinMaxStringFromTypeDef(const char* t, int& min umum, int& maximum, SString& def)130 return sscanf(t, "%lf %lf %lf", &minimum, &maximum, &def); 131 } 132 133 int ParamInterface::getMinMaxStringFromTypeDef(const char* t, int& minimum, int& maximum, SString& def) 134 134 { 135 135 while (*t) if (*t == ' ') break; else t++; 136 int ret = sscanf(t, "%d %d", &min umum, &maximum);136 int ret = sscanf(t, "%d %d", &minimum, &maximum); 137 137 def = SString::empty(); 138 138 if (ret == 2) -
cpp/frams/vm/classes/3dobject.cpp
r1158 r1302 437 437 Pt3D d; 438 438 Pt3D src = point->p; 439 d-= center->p;439 src -= center->p; 440 440 o.revTransform(d, src); 441 441 *ret = Pt3D_Ext::makeDynamicObject(new Pt3D_Ext(d));
Note: See TracChangeset
for help on using the changeset viewer.