Changeset 1323 for cpp/frams/model
- Timestamp:
- 08/12/24 03:48:20 (5 months ago)
- Location:
- cpp/frams/model
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/model.cpp
r1286 r1323 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-202 3Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2024 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 1289 1289 } 1290 1290 1291 void Model::buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape, double thickness)1291 void Model::buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape, double radius) 1292 1292 { 1293 1293 for (int i = 0; i < src_ballandstick_shapes.getJointCount(); i++) … … 1300 1300 p->setRot(o.getAngles()); 1301 1301 p->scale.x = oj->part1->p.distanceTo(oj->part2->p) / 2; 1302 p->scale.y = thickness;1303 p->scale.z = thickness;1302 p->scale.y = radius; 1303 p->scale.z = radius; 1304 1304 } 1305 1305 if (src_ballandstick_shapes.getJointCount() == 0) //single part "ball-and-stick" models are valid so let's make a valid solid shape model … … 1310 1310 p->p = op->p; 1311 1311 p->rot = op->rot; 1312 p->scale.x = p->scale.y = p->scale.z = thickness;1312 p->scale.x = p->scale.y = p->scale.z = radius; 1313 1313 } 1314 1314 for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++) … … 1334 1334 } 1335 1335 1336 SolidsShapeTypeModel::SolidsShapeTypeModel(Model &m, Part::Shape use_shape, double thickness)1336 SolidsShapeTypeModel::SolidsShapeTypeModel(Model &m, Part::Shape use_shape, double radius) 1337 1337 { 1338 1338 using_model = converted_model = NULL; … … 1341 1341 converted_model = new Model; 1342 1342 converted_model->open(); 1343 converted_model->buildUsingSolidShapeTypes(m, use_shape, thickness);1343 converted_model->buildUsingSolidShapeTypes(m, use_shape, radius); 1344 1344 converted_model->close(); 1345 1345 using_model = converted_model; -
cpp/frams/model/model.h
r1130 r1323 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-202 1Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2024 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 390 390 391 391 /// build this model using solid shape types, based on the provided ball-and-stick model. See also shapeconvert.cpp. 392 void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = Part::DEFAULT_STICK_RADIUS);392 void buildUsingSolidShapeTypes(const Model &src_ballandstick_shapes, Part::Shape use_shape = Part::SHAPE_CYLINDER, double radius = Part::BALL_AND_STICK_RADIUS); 393 393 394 394 protected: … … 443 443 Model *converted_model; 444 444 Model *using_model; 445 SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double thickness = Part::DEFAULT_STICK_RADIUS);445 SolidsShapeTypeModel(Model &m, Part::Shape use_shape = Part::SHAPE_CYLINDER, double radius = Part::BALL_AND_STICK_RADIUS); 446 446 operator Model &() { return *using_model; } 447 447 Model &getModel() { return *using_model; } -
cpp/frams/model/modelparts.h
r1318 r1323 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-202 1Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2024 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 103 103 }; 104 104 static const char* getShapeName(Shape sh); 105 static constexpr double DEFAULT_STICK_RADIUS = 0.15; //used in odesim, VisualModel, CreatureObj3D, and SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion105 static constexpr double BALL_AND_STICK_RADIUS = 0.15; //used in odesim, VisualModel, CreatureObj3D, and SHAPETYPE_BALL_AND_STICK to SHAPETYPE_SOLIDS Model conversion 106 106 107 107 double mass, size, density, friction, ingest, assim, hollow;
Note: See TracChangeset
for help on using the changeset viewer.