| 521 | "); |
| 522 | |
| 523 | static PyObject * |
| 524 | Geom_loft(PyObject* self, PyObject* args, PyObject* kwargs) |
| 525 | { |
| 526 | #ifdef dbg_Geom_loft |
| 527 | std::cout << " " << std::endl; |
| 528 | std::cout << "========== Geom_loft ==========" << std::endl; |
| 529 | #endif |
| 530 | |
| 531 | auto api = PyUtilApiFunction("O!O!", PyRunTimeErr, __func__); |
| 532 | static char *keywords[] = {"polydata_list", "loft_options", NULL}; |
| 533 | PyObject* objListArg; |
| 534 | PyObject* loftOptsArg; |
| 535 | |
| 536 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &PyList_Type, &objListArg, &PyLoftOptionsType, |
| 537 | &loftOptsArg)) { |
| 538 | return api.argsError(); |
| 539 | } |
| 540 | |
| 541 | // Check the list of polydata curve profiles. |
| 542 | auto cvPolyDataList = GetGeometryObjects(api, objListArg); |
| 543 | if (cvPolyDataList.size() == 0) { |
| 544 | return nullptr; |
| 545 | } |
| 546 | |
| 547 | if (cvPolyDataList.size() < 2) { |
| 548 | api.error("At least two profiles are needed for lofing."); |
| 549 | return nullptr; |
| 550 | } |
| 551 | |
| 552 | // Check that the profiles have the same number of points. |
| 553 | int numProfilePoints = 0; |
| 554 | for (auto const& profile : cvPolyDataList) { |
| 555 | int numPoints = profile->GetVtkPolyData()->GetNumberOfPoints(); |
| 556 | if (numProfilePoints == 0) { |
| 557 | numProfilePoints = numPoints; |
| 558 | } else if (numPoints != numProfilePoints) { |
| 559 | api.error("Profiles do not have the same number of points."); |
| 560 | return nullptr; |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | // Extract loft option values from the loftOptions object. |
| 565 | // |
| 566 | // Most of these are not used for now. |
| 567 | // |
| 568 | int numOutPtsInSegs = numProfilePoints; |
| 569 | int numOutPtsAlongLength = LoftOptionsGetInt(loftOptsArg, LoftOptions::NUM_OUT_PTS_ALONG_LENGTH); |
| 570 | int numLinearPtsAlongLength = LoftOptionsGetInt(loftOptsArg, LoftOptions::NUM_LINEAR_PTS_ALONG_LENGTH); |
| 571 | int numModes = 0; /*LoftOptionsGetInt(loftOptsArg, LoftOptions::NUM_MODES); */ |
| 572 | int splineType = 0; /*LoftOptionsGetInt(loftOptsArg, LoftOptions::SPLINE_TYPE); */ |
| 573 | int useFFT = 0; /*LoftOptionsGetInt(loftOptsArg, LoftOptions::USE_FFT); */ |
| 574 | int useLinearSampleAlongLength = LoftOptionsGetInt(loftOptsArg, LoftOptions::USE_LINEAR_SAMPLE_ALONG_LENGTH); |
| 575 | double bias = 0.0; /*LoftOptionsGetDouble(loftOptsArg, LoftOptions::BIAS); */ |
| 576 | double tension = 0.0; /*LoftOptionsGetDouble(loftOptsArg, LoftOptions::TENSION); */ |
| 577 | double continuity = 0.0; /*LoftOptionsGetDouble(loftOptsArg, LoftOptions::CONTINUITY); */ |
| 578 | |
| 579 | #ifdef dbg_Geom_loft |
| 580 | std::cout << "[Geom_loft] numProfilePoints:" << numProfilePoints << std::endl; |
nothing calls this directly
no test coverage detected