Changeset 977 for cpp/frams/model
- Timestamp:
- 07/06/20 23:39:36 (5 years ago)
- Location:
- cpp/frams/model
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/modelparts.cpp
r975 r977 107 107 preflocation(_preflocation), 108 108 supported_shape_types(sup_shapes), 109 supported_joint_shapes(sup_joints), 109 110 vectordata(_vectordata), 110 111 visualhints(vhints), impl_count(0),/*impl(0),*/active(1), genactive(0) … … 624 625 } 625 626 627 const char* Part::getShapeName(Shape sh) 628 { 629 switch (sh) 630 { 631 case SHAPE_BALL_AND_STICK: return "ball-and-stick"; 632 case SHAPE_ELLIPSOID: return "ellipsoid"; 633 case SHAPE_CUBOID: return "cuboid"; 634 case SHAPE_CYLINDER: return "cylinder"; 635 636 default: 637 return "unknown shape"; 638 } 639 } 626 640 627 641 /////////////////////////// … … 709 723 } 710 724 725 const char* Joint::getShapeName(Shape sh) 726 { 727 switch (sh) 728 { 729 case SHAPE_BALL_AND_STICK: return "ball-and-stick"; 730 case SHAPE_FIXED: return "fixed"; 731 case SHAPE_HINGE_X: return "hinge x"; 732 case SHAPE_HINGE_XY: return "hinge xy"; 733 734 default: 735 return "unknown shape"; 736 } 737 } 738 739 711 740 ///////////////////////////////////////////////////////////////// 712 741 -
cpp/frams/model/modelparts.h
r975 r977 34 34 { 35 35 public: 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 }; 39 40 40 41 /** Common base for model elements. */ … … 95 96 /// 96 97 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 98 103 double mass, size, density, friction, ingest, assim, hollow; 99 104 Pt3D scale; … … 149 154 SHAPE_FIXED = 1, ///< merge parts into one physical entity 150 155 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 152 158 }; 153 159 paInt shape;///< values of type Shape (paInt for integration with Param) 160 static const char* getShapeName(Shape sh); 154 161 class Pt3D hinge_pos; ///< hinge position (relative to part1) for HINGE_X and HINGE_XY 155 162 class Pt3D hinge_rot; ///< hinge orientation (relative to part1) for HINGE_X and HINGE_XY … … 223 230 paInt preflocation; 224 231 232 enum PrefLocation { PREFER_UNATTACHED=0, PREFER_PART=1, PREFER_JOINT=2 }; 233 225 234 static constexpr int SUPPORTED_SHAPE_BALL_AND_STICK = 1; 226 235 static constexpr int SUPPORTED_SHAPE_SOLIDS = 2; … … 233 242 static constexpr int SUPPORTED_JOINT_HINGE_XY = 8; 234 243 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_xxx244 paInt supported_joint_shapes; //< bitfield of 'Joint::shape' values: NeuroClass::SUPPORTED_JOINT_xxx = 1 << JOINT::SHAPE_xxx 236 245 237 246 int *vectordata; … … 286 295 int getSupportedShapeTypes() { return (int)supported_shape_types; } 287 296 bool isShapeTypeSupported(ModelEnum::ShapeType t) { return (1 << (int)t) & supported_shape_types; } 288 int getSupportedJoint Types() { return (int)supported_joint_types; }289 bool isJoint TypeSupported(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; } 290 299 int *getSymbolGlyph() 291 300 {
Note: See TracChangeset
for help on using the changeset viewer.