Changeset 544 for cpp/frams


Ignore:
Timestamp:
07/28/16 01:09:29 (8 years ago)
Author:
Maciej Komosinski
Message:

Renamed:
Model::getShape() ==> Model::getShapeType()
Model::SHAPE_OLD ==> Model::SHAPE_BALL_AND_STICK
Model::SHAPE_NEW ==> Model::SHAPE_SOLIDS
Part::SHAPE_DEFAULT ==> Part::SHAPE_BALL_AND_STICK
Joint::SHAPE_DEFAULT ==> Joint::SHAPE_BALL_AND_STICK
Joint::SHAPE_SOLID ==> Joint::SHAPE_FIXED

Location:
cpp/frams
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/geometry/geometrytestutils.cpp

    r382 r544  
    244244        part->vcolor = Pt3D(1.0, 1.0, 0.0);
    245245       
    246         model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
     246        model.addNewJoint(anchor, part, Joint::SHAPE_FIXED);
    247247}
    248248
     
    258258        part->p = center;
    259259        part->vcolor = Pt3D(1.0, 0.0, 0.0);
    260         model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
     260        model.addNewJoint(anchor, part, Joint::SHAPE_FIXED);
    261261       
    262262        part = model.addNewPart(Part::SHAPE_CUBOID);
     
    265265        part->p = center;
    266266        part->vcolor = Pt3D(0.0, 1.0, 0.0);
    267         model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
     267        model.addNewJoint(anchor, part, Joint::SHAPE_FIXED);
    268268       
    269269        part = model.addNewPart(Part::SHAPE_CUBOID);
     
    272272        part->p = center;
    273273        part->vcolor = Pt3D(0.0, 0.0, 1.0);
    274         model.addNewJoint(anchor, part, Joint::SHAPE_SOLID);
     274        model.addNewJoint(anchor, part, Joint::SHAPE_FIXED);
    275275}
    276276
     
    282282        target.moveElementsFrom(source);
    283283       
    284         target.addNewJoint(targetAnchor, sourceAnchor, Joint::SHAPE_SOLID);
     284        target.addNewJoint(targetAnchor, sourceAnchor, Joint::SHAPE_FIXED);
    285285}
    286286
  • cpp/frams/_demos/part_shapes.cpp

    r534 r544  
    3030                p2->setOrient(p1->o.transform(rotation)); //rotation transformed by p1's orientation
    3131
    32                 m.addNewJoint(p1, p2, Joint::SHAPE_SOLID); //all parts must be connected
     32                m.addNewJoint(p1, p2, Joint::SHAPE_FIXED); //all parts must be connected
    3333        }
    3434
     
    4545                        p2->scale = Pt3D(prev.distanceTo(next)*0.5, 0.05, 0.05);// distance*0.5 because scale is "radius", not cylinder length
    4646
    47                         m.addNewJoint(p1, p2, Joint::SHAPE_SOLID); //all parts must be connected
     47                        m.addNewJoint(p1, p2, Joint::SHAPE_FIXED); //all parts must be connected
    4848                }
    4949                p1 = p2;
  • cpp/frams/_demos/shapeconvert.cpp

    r534 r544  
    7575        }
    7676
    77         if (m.getShape() != Model::SHAPE_OLD)
     77        if (m.getShapeType() != Model::SHAPE_BALL_AND_STICK)
    7878        {
    79                 logPrintf("", "shapeconvert", LOG_ERROR, "Only old style shapes can be converted");
     79                logPrintf("", "shapeconvert", LOG_ERROR, "Only ball-and-stick models can be converted");
    8080                return 3;
    8181        }
  • cpp/frams/genetics/fF/conv_fF.cpp

    r348 r544  
    5959                Part *p2 = addNewPart(&m, chambers[i]);
    6060                p2->scale = p1->scale.entrywiseProduct(Pt3D(gp.scalex, gp.scaley, gp.scalez)); //each part's scale is its predecessor's scale * scaling
    61                 m.addNewJoint(p1, p2, Joint::SHAPE_SOLID); //all parts must be connected
     61                m.addNewJoint(p1, p2, Joint::SHAPE_FIXED); //all parts must be connected
    6262                p1 = p2;
    6363        }
     
    6868
    6969        m.close();
    70         return m.getF0Geno().getGene();
     70        return m.getF0Geno().getGenes();
    7171}
    7272
  • cpp/frams/model/model.cpp

    r536 r544  
    944944                        if (p->p.z + p->size > bbmax.z) bbmax.z = p->p.z + p->size;
    945945                        if (shape == SHAPE_UNKNOWN)
    946                                 shape = (p->shape == Part::SHAPE_DEFAULT) ? SHAPE_OLD : SHAPE_NEW;
     946                                shape = (p->shape == Part::SHAPE_BALL_AND_STICK) ? SHAPE_BALL_AND_STICK : SHAPE_SOLIDS;
    947947                        else if (shape != SHAPE_ILLEGAL)
    948948                        {
    949                                 if ((p->shape == Part::SHAPE_DEFAULT) ^ (shape == SHAPE_OLD))
     949                                if ((p->shape == Part::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
    950950                                {
    951951                                        shape = SHAPE_ILLEGAL;
    952                                         logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed old and new shapes)%s", nameForErrors().c_str());
     952                                        logPrintf("Model", "internalCheck", LOG_WARN, "Inconsistent part shapes (mixed ball-and-stick and solids shape types)%s", nameForErrors().c_str());
    953953                                }
    954954                        }
     
    10141014                                if (final)
    10151015                                {
    1016                                         if (j->shape != Joint::SHAPE_SOLID)
     1016                                        if (j->shape != Joint::SHAPE_FIXED)
    10171017                                        {
    10181018                                                if (j->d() > getMaxJoint().d.x)
     
    10311031                        if (shape != SHAPE_ILLEGAL)
    10321032                        {
    1033                                 if ((j->shape == Joint::SHAPE_DEFAULT) ^ (shape == SHAPE_OLD))
     1033                                if ((j->shape == Joint::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK))
    10341034                                {
    10351035                                        shape = SHAPE_ILLEGAL;
     
    13631363                                        if ((oj2->part1 == op) || (oj2->part2 == op))
    13641364                                        {
    1365                                                 addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_SOLID);
     1365                                                addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_FIXED);
    13661366                                        }
    13671367                                }
  • cpp/frams/model/model.h

    r522 r544  
    119119
    120120public:
    121         enum Shape { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_OLD, SHAPE_NEW };
     121        enum ShapeType { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_BALL_AND_STICK, SHAPE_SOLIDS };
    122122protected:
    123         Shape shape;
     123        ShapeType shape;
    124124
    125125        void updateNeuroRefno(); // set Neuro::refno for all neurons
     
    156156        int isValid() const { return buildstatus == valid; }
    157157        int getErrorPosition(bool includingwarnings = false);
    158         Shape getShape() { return shape; }
     158        ShapeType getShapeType() const { return shape; }
    159159
    160160        void updateRefno(); // set ::refno for all elements
     
    359359
    360360        /** create new Part and add it to the model. @see addPart()  */
    361         Part *addNewPart(Part::Shape shape = Part::SHAPE_DEFAULT) { return addPart(new Part(shape)); }
     361        Part *addNewPart(Part::Shape shape = Part::SHAPE_BALL_AND_STICK) { return addPart(new Part(shape)); }
    362362        /** create new Joint and add it to the model. @see addJoint() */
    363         Joint *addNewJoint(Part *p1 = NULL, Part *p2 = NULL, Joint::Shape shape = Joint::SHAPE_DEFAULT) { Joint *j = addJoint(new Joint()); j->shape = shape; if ((p1 != NULL) && (p2 != NULL)) j->attachToParts(p1, p2); return j; }
     363        Joint *addNewJoint(Part *p1 = NULL, Part *p2 = NULL, Joint::Shape shape = Joint::SHAPE_BALL_AND_STICK) { Joint *j = addJoint(new Joint()); j->shape = shape; if ((p1 != NULL) && (p2 != NULL)) j->attachToParts(p1, p2); return j; }
    364364        /** create new Neuro and add it to the model. @see addNeuro() */
    365365        Neuro *addNewNeuro() { return addNeuro(new Neuro()); }
  • cpp/frams/model/modelparts.h

    r408 r544  
    8585///
    8686paInt shape;///default=old Framsticks compatible, do not mix with shapes>0
    87 enum Shape {SHAPE_DEFAULT=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3};
     87enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3};
    8888double mass,size,density,friction,ingest,assim,hollow;
    8989Pt3D scale;
     
    9595double vsize;
    9696
    97 Part(enum Shape s=SHAPE_DEFAULT);
     97Part(enum Shape s=SHAPE_BALL_AND_STICK);
    9898Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);}
    9999void operator=(const Part& src);
     
    124124class Pt3D d;           ///< position delta between parts
    125125class Pt3D rot; ///< orientation delta between parts expressed as 3 angles
    126 enum Shape {SHAPE_DEFAULT=0, SHAPE_SOLID=1};
    127 paInt shape;///< default=old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0,  solid=merge parts into one physical entity
     126enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_FIXED=1};
     127paInt shape;///< ball-and-stick=old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0,  fixed=merge parts into one physical entity
    128128
    129129Joint();
Note: See TracChangeset for help on using the changeset viewer.