- Timestamp:
- 07/28/16 01:09:29 (8 years ago)
- Location:
- cpp/frams
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/_demos/geometry/geometrytestutils.cpp
r382 r544 244 244 part->vcolor = Pt3D(1.0, 1.0, 0.0); 245 245 246 model.addNewJoint(anchor, part, Joint::SHAPE_ SOLID);246 model.addNewJoint(anchor, part, Joint::SHAPE_FIXED); 247 247 } 248 248 … … 258 258 part->p = center; 259 259 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); 261 261 262 262 part = model.addNewPart(Part::SHAPE_CUBOID); … … 265 265 part->p = center; 266 266 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); 268 268 269 269 part = model.addNewPart(Part::SHAPE_CUBOID); … … 272 272 part->p = center; 273 273 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); 275 275 } 276 276 … … 282 282 target.moveElementsFrom(source); 283 283 284 target.addNewJoint(targetAnchor, sourceAnchor, Joint::SHAPE_ SOLID);284 target.addNewJoint(targetAnchor, sourceAnchor, Joint::SHAPE_FIXED); 285 285 } 286 286 -
cpp/frams/_demos/part_shapes.cpp
r534 r544 30 30 p2->setOrient(p1->o.transform(rotation)); //rotation transformed by p1's orientation 31 31 32 m.addNewJoint(p1, p2, Joint::SHAPE_ SOLID); //all parts must be connected32 m.addNewJoint(p1, p2, Joint::SHAPE_FIXED); //all parts must be connected 33 33 } 34 34 … … 45 45 p2->scale = Pt3D(prev.distanceTo(next)*0.5, 0.05, 0.05);// distance*0.5 because scale is "radius", not cylinder length 46 46 47 m.addNewJoint(p1, p2, Joint::SHAPE_ SOLID); //all parts must be connected47 m.addNewJoint(p1, p2, Joint::SHAPE_FIXED); //all parts must be connected 48 48 } 49 49 p1 = p2; -
cpp/frams/_demos/shapeconvert.cpp
r534 r544 75 75 } 76 76 77 if (m.getShape () != Model::SHAPE_OLD)77 if (m.getShapeType() != Model::SHAPE_BALL_AND_STICK) 78 78 { 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"); 80 80 return 3; 81 81 } -
cpp/frams/genetics/fF/conv_fF.cpp
r348 r544 59 59 Part *p2 = addNewPart(&m, chambers[i]); 60 60 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 connected61 m.addNewJoint(p1, p2, Joint::SHAPE_FIXED); //all parts must be connected 62 62 p1 = p2; 63 63 } … … 68 68 69 69 m.close(); 70 return m.getF0Geno().getGene ();70 return m.getF0Geno().getGenes(); 71 71 } 72 72 -
cpp/frams/model/model.cpp
r536 r544 944 944 if (p->p.z + p->size > bbmax.z) bbmax.z = p->p.z + p->size; 945 945 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; 947 947 else if (shape != SHAPE_ILLEGAL) 948 948 { 949 if ((p->shape == Part::SHAPE_ DEFAULT) ^ (shape == SHAPE_OLD))949 if ((p->shape == Part::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK)) 950 950 { 951 951 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()); 953 953 } 954 954 } … … 1014 1014 if (final) 1015 1015 { 1016 if (j->shape != Joint::SHAPE_ SOLID)1016 if (j->shape != Joint::SHAPE_FIXED) 1017 1017 { 1018 1018 if (j->d() > getMaxJoint().d.x) … … 1031 1031 if (shape != SHAPE_ILLEGAL) 1032 1032 { 1033 if ((j->shape == Joint::SHAPE_ DEFAULT) ^ (shape == SHAPE_OLD))1033 if ((j->shape == Joint::SHAPE_BALL_AND_STICK) ^ (shape == SHAPE_BALL_AND_STICK)) 1034 1034 { 1035 1035 shape = SHAPE_ILLEGAL; … … 1363 1363 if ((oj2->part1 == op) || (oj2->part2 == op)) 1364 1364 { 1365 addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_ SOLID);1365 addNewJoint(getPart(j), getPart(j2), Joint::SHAPE_FIXED); 1366 1366 } 1367 1367 } -
cpp/frams/model/model.h
r522 r544 119 119 120 120 public: 121 enum Shape { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_OLD, SHAPE_NEW};121 enum ShapeType { SHAPE_UNKNOWN, SHAPE_ILLEGAL, SHAPE_BALL_AND_STICK, SHAPE_SOLIDS }; 122 122 protected: 123 Shape shape;123 ShapeType shape; 124 124 125 125 void updateNeuroRefno(); // set Neuro::refno for all neurons … … 156 156 int isValid() const { return buildstatus == valid; } 157 157 int getErrorPosition(bool includingwarnings = false); 158 Shape getShape(){ return shape; }158 ShapeType getShapeType() const { return shape; } 159 159 160 160 void updateRefno(); // set ::refno for all elements … … 359 359 360 360 /** 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)); } 362 362 /** 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; } 364 364 /** create new Neuro and add it to the model. @see addNeuro() */ 365 365 Neuro *addNewNeuro() { return addNeuro(new Neuro()); } -
cpp/frams/model/modelparts.h
r408 r544 85 85 /// 86 86 paInt 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};87 enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3}; 88 88 double mass,size,density,friction,ingest,assim,hollow; 89 89 Pt3D scale; … … 95 95 double vsize; 96 96 97 Part(enum Shape s=SHAPE_ DEFAULT);97 Part(enum Shape s=SHAPE_BALL_AND_STICK); 98 98 Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);} 99 99 void operator=(const Part& src); … … 124 124 class Pt3D d; ///< position delta between parts 125 125 class 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 entity126 enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_FIXED=1}; 127 paInt 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 128 128 129 129 Joint();
Note: See TracChangeset
for help on using the changeset viewer.