Changeset 1302


Ignore:
Timestamp:
04/25/24 21:59:54 (8 months ago)
Author:
Maciej Komosinski
Message:

Cosmetic / minor fixes

Location:
cpp
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd_math.h

    r1298 r1302  
    2525inline double rndDouble(double limit_exclusive) { return rndGetInstance().getDouble() * limit_exclusive; }
    2626inline 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
    2728inline unsigned int rndUint(size_t limit_exclusive) {return rndUint((unsigned int)limit_exclusive);} //just an overload with size_t argument
     29#endif
    2830unsigned int rndUint(int limit_exclusive); //just an overload with int argument
    2931inline void rndSetSeed(unsigned int seed) { rndGetInstance().setSeed(seed); }
  • cpp/frams/_demos/geneprops_graph.py

    r1242 r1302  
    4343        segs.append( ((len(n[0]),n[1]),(len(n[0])+1,child[1])) )
    4444
    45 linecol = LineCollection(segs, linewidths=2, linestyle='solid')
     45linecol = LineCollection(segs, linewidths=2, linestyle='solid', color='#ddddff')
    4646ax.add_collection(linecol)
    4747
     
    5555
    5656ax.xaxis.set_visible(False)
     57plt.tight_layout()
    5758plt.show()
  • cpp/frams/_demos/geneprops_test.cpp

    r1260 r1302  
    1010Examples:
    1111
    12 - new experimental friction:
     12- experimental exponential friction:
    1313$ ./geneprops_test f 3 -e | sort -n -k 2
    1414
     
    9494                        case 'e': fun = ExperimentalExponential; break;
    9595                        case 'h': printf("%s args: [modifier [max_count]] (one of " F14_MODIFIERS ")\n"
    96                                 "\t-l = legacy function\n"
     96                                "\t-l = legacy\n"
    9797                                "\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]);
    9999                                return 0;
    100100                        default: fprintf(stderr, "%s: invalid option: %s\n", argv[0], arg); return 2;
  • cpp/frams/genetics/f1/f1_conv.cpp

    r1258 r1302  
    2323          "- Full/NumberOfBranches - a compromise between the two other settings.\n"
    2424          "- 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."},
    2626
    2727        { 0, },
     
    331331{
    332332        double len = std::min(2.0, c.length);
     333        Part *p1 = model.getPart(part1);
     334        Part *p2 = model.getPart(part2);
    333335        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);
    335337        lastjoint_muscle_power = c.muscle_power;
    336338        return model.addFromString(Model::JointType, tmp, makeRange(g));
  • cpp/frams/model/modelparts.h

    r1280 r1302  
    103103        };
    104104        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 conversion
     105        static constexpr double DEFAULT_STICK_RADIUS = 0.15; //used in odesim and in SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion
    106106
    107107        double mass, size, density, friction, ingest, assim, hollow;
  • cpp/frams/param/param.cpp

    r1278 r1302  
    104104}
    105105
    106 int ParamInterface::getMinMaxInt(int prop, paInt& minumum, paInt& maximum, paInt &def)
    107 {
    108         return getMinMaxIntFromTypeDef(type(prop), minumum, maximum, def);
    109 }
    110 
    111 int ParamInterface::getMinMaxDouble(int prop, double& minumum, double& maximum, double& def)
    112 {
    113         return getMinMaxDoubleFromTypeDef(type(prop), minumum, maximum, def);
    114 }
    115 
    116 int ParamInterface::getMinMaxString(int prop, int& minumum, int& maximum, SString& def)
    117 {
    118         return getMinMaxStringFromTypeDef(type(prop), minumum, maximum, def);
    119 }
    120 
    121 int ParamInterface::getMinMaxIntFromTypeDef(const char* t, paInt& minumum, paInt& maximum, paInt &def)
     106int ParamInterface::getMinMaxInt(int prop, paInt& minimum, paInt& maximum, paInt &def)
     107{
     108        return getMinMaxIntFromTypeDef(type(prop), minimum, maximum, def);
     109}
     110
     111int ParamInterface::getMinMaxDouble(int prop, double& minimum, double& maximum, double& def)
     112{
     113        return getMinMaxDoubleFromTypeDef(type(prop), minimum, maximum, def);
     114}
     115
     116int ParamInterface::getMinMaxString(int prop, int& minimum, int& maximum, SString& def)
     117{
     118        return getMinMaxStringFromTypeDef(type(prop), minimum, maximum, def);
     119}
     120
     121int ParamInterface::getMinMaxIntFromTypeDef(const char* t, paInt& minimum, paInt& maximum, paInt &def)
    122122{
    123123        while (*t) if (*t == ' ') break; else t++;
    124         return sscanf(t, PA_INT_SCANF " " PA_INT_SCANF " " PA_INT_SCANF, &minumum, &maximum, &def);
    125 }
    126 
    127 int ParamInterface::getMinMaxDoubleFromTypeDef(const char* t, double& minumum, double& maximum, double& def)
     124        return sscanf(t, PA_INT_SCANF " " PA_INT_SCANF " " PA_INT_SCANF, &minimum, &maximum, &def);
     125}
     126
     127int ParamInterface::getMinMaxDoubleFromTypeDef(const char* t, double& minimum, double& maximum, double& def)
    128128{
    129129        while (*t) if (*t == ' ') break; else t++;
    130         return sscanf(t, "%lg %lg %lg", &minumum, &maximum, &def);
    131 }
    132 
    133 int ParamInterface::getMinMaxStringFromTypeDef(const char* t, int& minumum, int& maximum, SString& def)
     130        return sscanf(t, "%lf %lf %lf", &minimum, &maximum, &def);
     131}
     132
     133int ParamInterface::getMinMaxStringFromTypeDef(const char* t, int& minimum, int& maximum, SString& def)
    134134{
    135135        while (*t) if (*t == ' ') break; else t++;
    136         int ret = sscanf(t, "%d %d", &minumum, &maximum);
     136        int ret = sscanf(t, "%d %d", &minimum, &maximum);
    137137        def = SString::empty();
    138138        if (ret == 2)
  • cpp/frams/vm/classes/3dobject.cpp

    r1158 r1302  
    437437                Pt3D d;
    438438                Pt3D src = point->p;
    439                 d -= center->p;
     439                src -= center->p;
    440440                o.revTransform(d, src);
    441441                *ret = Pt3D_Ext::makeDynamicObject(new Pt3D_Ext(d));
Note: See TracChangeset for help on using the changeset viewer.