Changeset 896 for cpp/frams/model/model.h
- Timestamp:
- 11/30/19 01:30:22 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/model.h
r815 r896 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-201 8Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2019 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 77 77 SList parts, joints, neurons; 78 78 char partmappingchanged; 79 vector<Model *> checkpoints;79 vector<Model *> checkpoints; 80 80 81 81 void internalCopy(const Model &mod); … … 141 141 142 142 int getCheckpointCount(); 143 Model *getCheckpoint(int i);143 Model *getCheckpoint(int i); 144 144 145 145 /// The bounding box size. Valid if the model is valid. Read only. … … 201 201 202 202 /// change source genotype 203 void setGeno(const Geno &newgeno);203 void setGeno(const Geno &newgeno); 204 204 205 205 /** @return f0 genotype - generated from current model state … … 241 241 @see convmap 242 242 */ 243 void getCurrentToF0Map(MultiMap &m);243 void getCurrentToF0Map(MultiMap &m); 244 244 245 245 void setValidationLevel(int level) … … 250 250 /// calculate location of the new part connected to the existing one 251 251 /// using delta option 252 Pt3D whereDelta(const Part & start, const Pt3D& rot, const Pt3D&delta);252 Pt3D whereDelta(const Part &start, const Pt3D &rot, const Pt3D &delta); 253 253 254 254 /// create the whole model from scratch, using current genotype … … 256 256 257 257 /// setGeno(newgeno); rebuild(); 258 void rebuild(const Geno &newgeno, bool buildmaps) { setGeno(newgeno); rebuild(buildmaps); }258 void rebuild(const Geno &newgeno, bool buildmaps) { setGeno(newgeno); rebuild(buildmaps); } 259 259 260 260 /// reuse current model object but discard all model data … … 262 262 263 263 enum ItemType { UnknownType, ModelType, PartType, JointType, NeuronType, NeuronConnectionType, CheckpointType }; 264 static ItemType itemTypeFromLinePrefix(const char *line);264 static ItemType itemTypeFromLinePrefix(const char *line); 265 265 /** Execute single line of <B>f0</B> genotype. 266 266 Return value is non-negative reference number of the created item, … … 270 270 @param srcrange source genotype range which will be mapped to this element 271 271 */ 272 int addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange *srcrange = NULL);272 int addFromString(ItemType item_type, const SString &singleline, int line_num, const MultiRange *srcrange = NULL); 273 273 /** Execute single line of <B>f0</B> genotype - compatiblity variant */ 274 int addFromString(ItemType item_type, const SString &singleline, const MultiRange *srcrange = NULL);274 int addFromString(ItemType item_type, const SString &singleline, const MultiRange *srcrange = NULL); 275 275 /** Execute single line of <B>f0</B> genotype - low level variant, used by Model::build(), error messages returned as string instead of calling logger */ 276 int addFromStringNoLog(ItemType item_type, const SString &singleline, SString & error_message, const MultiRange*srcrange = 0);276 int addFromStringNoLog(ItemType item_type, const SString &singleline, SString &error_message, const MultiRange *srcrange = 0); 277 277 278 278 /// separate build stages (for future use) … … 357 357 358 358 /// @return part index or -1 if not found in the model 359 int findPart(Part *p);359 int findPart(Part *p); 360 360 /// @return joint index or -1 if not found in the model 361 int findJoint(Joint *j);361 int findJoint(Joint *j); 362 362 /// @return neuro index or -1 if not found in the model 363 int findNeuro(Neuro *nu);363 int findNeuro(Neuro *nu); 364 364 /// @return joint index or -1 if not found in the model 365 365 int findJoint(Part *p1, Part *p2); … … 368 368 @param result objects will be appended here 369 369 @return number of objects found */ 370 int findNeuros(SList & result, const char* classname = 0, const Part* part = 0, const Joint*joint = 0);370 int findNeuros(SList &result, const char *classname = 0, const Part *part = 0, const Joint *joint = 0); 371 371 372 372 /** search for joints connected to the part 373 373 @param result objects will be appended here 374 374 @return number of objects found */ 375 int findJoints(SList & result, const Part*part = 0);375 int findJoints(SList &result, const Part *part = 0); 376 376 377 377 void disturb(double amount); 378 void move(const Pt3D &shift);378 void move(const Pt3D &shift); 379 379 /// rotate around the origin (move-rotate-move to rotate around arbitrary point) 380 void rotate(const Orient &rotation);380 void rotate(const Orient &rotation); 381 381 /// rotate around the origin (move-rotate-move to rotate around arbitrary point) 382 void rotate(const Pt3D &angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); }382 void rotate(const Pt3D &angles) { Orient o = Orient_1; o.rotate(angles); rotate(o); } 383 383 384 384 /// build this model using solid shape types, based on the provided ball-and-stick model. See also shapeconvert.cpp. 385 void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);385 void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2); 386 386 387 387 protected: … … 403 403 static int mapToNeuro(int i); 404 404 405 static void makeGenToGenMap(MultiMap & result, const MultiMap& gen1tomodel, const MultiMap&gen2tomodel);405 static void makeGenToGenMap(MultiMap &result, const MultiMap &gen1tomodel, const MultiMap &gen2tomodel); 406 406 407 407 /////////////////////////// 408 408 409 static Part &getMinPart();410 static Part &getMaxPart();411 static Part &getDefPart();412 static Joint &getMinJoint();413 static Joint &getMaxJoint();414 static Joint &getDefJoint();415 static Neuro &getMinNeuro();416 static Neuro &getMaxNeuro();417 static Neuro &getDefNeuro();409 static Part &getMinPart(); 410 static Part &getMaxPart(); 411 static Part &getDefPart(); 412 static Joint &getMinJoint(); 413 static Joint &getMaxJoint(); 414 static Joint &getDefJoint(); 415 static Neuro &getMinNeuro(); 416 static Neuro &getMaxNeuro(); 417 static Neuro &getDefNeuro(); 418 418 }; 419 419 … … 436 436 Model *converted_model; 437 437 Model *using_model; 438 SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2);439 operator Model &() { return *using_model; }440 Model &getModel() { return *using_model; }438 SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = 0.2); 439 operator Model &() { return *using_model; } 440 Model &getModel() { return *using_model; } 441 441 ~SolidsShapeTypeModel() { if (converted_model) delete converted_model; } 442 442 };
Note: See TracChangeset
for help on using the changeset viewer.