Ignore:
Timestamp:
07/06/20 23:39:36 (4 years ago)
Author:
Maciej Komosinski
Message:

Renamed functions for consistency; added an example of using getSupportedShapeTypes() and getSupportedJointShapes()

File:
1 edited

Legend:

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

    r975 r977  
    3434{
    3535public:
    36         enum ShapeType { SHAPE_BALL_AND_STICK = 0, SHAPE_SOLIDS = 1, SHAPE_UNKNOWN, SHAPE_ILLEGAL }; ///< 0 and 1 have special significance - these values allow for bit operations.
    37 };
    38 
     36        enum ShapeType { SHAPE_BALL_AND_STICK = 0, SHAPE_SOLIDS = 1, SHAPE_UNKNOWN, SHAPE_ILLEGAL, ///< 0 and 1 have special significance - these values allow for bit operations.
     37                         SHAPE_FIRST = SHAPE_BALL_AND_STICK, SHAPE_LAST = SHAPE_SOLIDS // for iteration
     38        };
     39};
    3940
    4041/** Common base for model elements. */
     
    9596        ///
    9697        paInt shape;///default=old Framsticks compatible, do not mix with shapes>0
    97         enum Shape { SHAPE_BALL_AND_STICK = 0, SHAPE_ELLIPSOID = 1, SHAPE_CUBOID = 2, SHAPE_CYLINDER = 3 };
     98        enum Shape { SHAPE_BALL_AND_STICK = 0, SHAPE_ELLIPSOID = 1, SHAPE_CUBOID = 2, SHAPE_CYLINDER = 3,
     99                     SHAPE_FIRST = SHAPE_BALL_AND_STICK, SHAPE_LAST = SHAPE_CYLINDER // for iteration
     100        };
     101        static const char* getShapeName(Shape sh);
     102
    98103        double mass, size, density, friction, ingest, assim, hollow;
    99104        Pt3D scale;
     
    149154                SHAPE_FIXED = 1, ///< merge parts into one physical entity
    150155                SHAPE_HINGE_X = 2, ///< hinge connection, revolving around X axis defined by hinge_pos and hinge_rot
    151                 SHAPE_HINGE_XY = 3 ///< double hinge connection, revolving around X and Y axes defined by hinge_pos and hinge_rot
     156                SHAPE_HINGE_XY = 3, ///< double hinge connection, revolving around X and Y axes defined by hinge_pos and hinge_rot
     157                SHAPE_FIRST = SHAPE_BALL_AND_STICK, SHAPE_LAST = SHAPE_HINGE_XY // for iteration
    152158        };
    153159        paInt shape;///< values of type Shape (paInt for integration with Param)
     160        static const char* getShapeName(Shape sh);
    154161        class Pt3D hinge_pos; ///< hinge position (relative to part1) for HINGE_X and HINGE_XY
    155162        class Pt3D hinge_rot; ///< hinge orientation (relative to part1) for HINGE_X and HINGE_XY
     
    223230        paInt preflocation;
    224231
     232        enum PrefLocation { PREFER_UNATTACHED=0, PREFER_PART=1, PREFER_JOINT=2 };
     233       
    225234        static constexpr int SUPPORTED_SHAPE_BALL_AND_STICK = 1;
    226235        static constexpr int SUPPORTED_SHAPE_SOLIDS = 2;
     
    233242        static constexpr int SUPPORTED_JOINT_HINGE_XY = 8;
    234243        static constexpr int SUPPORTED_JOINT_ALL = SUPPORTED_JOINT_BALL_AND_STICK + SUPPORTED_JOINT_FIXED + SUPPORTED_JOINT_HINGE_X + SUPPORTED_JOINT_HINGE_XY;
    235         paInt supported_joint_types; //< bitfield of 'Joint::shape' values: NeuroClass::SUPPORTED_JOINT_xxx = 1 << JOINT::SHAPE_xxx
     244        paInt supported_joint_shapes; //< bitfield of 'Joint::shape' values: NeuroClass::SUPPORTED_JOINT_xxx = 1 << JOINT::SHAPE_xxx
    236245
    237246        int *vectordata;
     
    286295        int getSupportedShapeTypes() { return (int)supported_shape_types; }
    287296        bool isShapeTypeSupported(ModelEnum::ShapeType t) { return (1 << (int)t) & supported_shape_types; }
    288         int getSupportedJointTypes() { return (int)supported_joint_types; }
    289         bool isJointTypeSupported(Joint::Shape t) { return (1 << (int)t) & supported_joint_types; }
     297        int getSupportedJointShapes() { return (int)supported_joint_shapes; }
     298        bool isJointShapeSupported(Joint::Shape t) { return (1 << (int)t) & supported_joint_shapes; }
    290299        int *getSymbolGlyph()
    291300        {
Note: See TracChangeset for help on using the changeset viewer.