Ignore:
Timestamp:
05/29/20 15:18:48 (4 years ago)
Author:
Maciej Komosinski
Message:

Introduced 'volume' field available by getMinPart(), getMaxPart(), getDefPart() for genetic operators to limit the range of volumes (~mass) in simulation of solids

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/modelparts.h

    r932 r934  
    2626typedef UserTags<Model, void *, 5> ModelUserTags;
    2727
     28
     29/// Introduced only because we can't have a forward declaration of enum in the Model class,
     30/// and we would need a forward declaration because of mutual (cyclic) dependence of declarations of Model and NeuroClass.
     31/// https://stackoverflow.com/questions/27019292/is-in-class-enum-forward-declaration-possible
     32/// Use Model::... instead of ModelEnum::...
     33class ModelEnum
     34{
     35public:
     36        enum ShapeType { SHAPE_BALL_AND_STICK, SHAPE_SOLIDS, SHAPE_UNKNOWN, SHAPE_ILLEGAL };
     37};
     38
     39
    2840/** Common base for model elements. */
    2941class PartBase
     
    102114
    103115        static Param &getStaticParam();
     116};
     117
     118class Part_MinMaxDef : public Part //contains additional information for Model::getMinPart()/getMaxPart()/getDefPart()
     119{
     120public:
     121        double volume; ///< Introduced to limit the range of volumes (~mass) in simulation of solids. Genetic operators should observe this min,max volume by calculating and limiting the volume of Parts based on their type and sx,sy,sz.
     122
     123        void defassign();
     124        Part_MinMaxDef() { defassign(); }
    104125};
    105126
     
    256277                */
    257278        int getSupportedShapeTypes() { return (int)supported_shape_types; }
     279        bool isShapeTypeSupported(ModelEnum::ShapeType t) { return (1 << (int)t) & supported_shape_types; }
    258280        int *getSymbolGlyph()
    259281        {
     
    511533};
    512534
    513 extern ParamEntry f0_part_paramtab[], f0_joint_paramtab[], f0_nodeltajoint_paramtab[], f0_neuro_paramtab[], f0_neuroconn_paramtab[], f0_neuroitem_paramtab[];
     535extern ParamEntry f0_part_paramtab[], f0_part_minmaxdef_paramtab[], f0_joint_paramtab[], f0_nodeltajoint_paramtab[], f0_neuro_paramtab[], f0_neuroconn_paramtab[], f0_neuroitem_paramtab[];
    514536
    515537#endif
Note: See TracChangeset for help on using the changeset viewer.