Changeset 546 for cpp/frams/model/model.cpp
- Timestamp:
- 07/28/16 03:39:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/model.cpp
r544 r546 973 973 j->p2_refno = j->part2->refno; 974 974 if (checklevel > 0) 975 975 { 976 976 j->part1->mass += 1.0; 977 977 j->part2->mass += 1.0; 978 978 } 979 979 if ((j->usedelta) && ((j->d.x != JOINT_DELTA_MARKER) || (j->d.y != JOINT_DELTA_MARKER) || (j->d.z != JOINT_DELTA_MARKER))) 980 980 { // delta positioning -> calc. orient. … … 1336 1336 } 1337 1337 1338 void Model::buildUsing NewShapes(const Model& old, Part::Shape default_shape, float thickness)1339 { 1340 for (int i = 0; i < old.getJointCount(); i++)1341 { 1342 Joint *oj = old.getJoint(i);1343 Part *p = addNewPart( default_shape);1338 void Model::buildUsingSolidShapeTypes(const Model& src_ballandstick_shapes, Part::Shape use_shape, float thickness) 1339 { 1340 for (int i = 0; i < src_ballandstick_shapes.getJointCount(); i++) 1341 { 1342 Joint *oj = src_ballandstick_shapes.getJoint(i); 1343 Part *p = addNewPart(use_shape); 1344 1344 p->p = (oj->part1->p + oj->part2->p) / 2; 1345 1345 Orient o; … … 1350 1350 p->scale.z = thickness; 1351 1351 } 1352 for (int i = 0; i < old.getPartCount(); i++)1353 { 1354 Part *op = old.getPart(i);1355 for (int j = 0; j < old.getJointCount(); j++)1356 { 1357 Joint *oj = old.getJoint(j);1352 for (int i = 0; i < src_ballandstick_shapes.getPartCount(); i++) 1353 { 1354 Part *op = src_ballandstick_shapes.getPart(i); 1355 for (int j = 0; j < src_ballandstick_shapes.getJointCount(); j++) 1356 { 1357 Joint *oj = src_ballandstick_shapes.getJoint(j); 1358 1358 if ((oj->part1 == op) || (oj->part2 == op)) 1359 1359 { 1360 for (int j2 = j + 1; j2 < old.getJointCount(); j2++)1360 for (int j2 = j + 1; j2 < src_ballandstick_shapes.getJointCount(); j2++) 1361 1361 { 1362 Joint *oj2 = old.getJoint(j2);1362 Joint *oj2 = src_ballandstick_shapes.getJoint(j2); 1363 1363 if ((oj2->part1 == op) || (oj2->part2 == op)) 1364 1364 { … … 1369 1369 } 1370 1370 } 1371 } 1372 } 1373 1374 SolidsShapeTypeModel::SolidsShapeTypeModel(const Model& m, Part::Shape use_shape, float thickness) 1375 { 1376 using_model = converted_model = NULL; 1377 if (m.getShapeType() == Model::SHAPE_BALL_AND_STICK) 1378 { 1379 converted_model = new Model; 1380 converted_model->open(); 1381 converted_model->buildUsingSolidShapeTypes(m, use_shape, thickness); 1382 converted_model->close(); 1383 using_model = converted_model; 1384 } 1385 else 1386 { 1387 converted_model = NULL; 1388 using_model = &m; 1371 1389 } 1372 1390 }
Note: See TracChangeset
for help on using the changeset viewer.