| 377 | "); |
| 378 | |
| 379 | static PyObject * |
| 380 | Geom_local_blend(PyObject* self, PyObject* args, PyObject* kwargs) |
| 381 | { |
| 382 | #ifdef dbg_Geom_local_blend |
| 383 | std::cout << " " << std::endl; |
| 384 | std::cout << "========== Geom_local_blend ==========" << std::endl; |
| 385 | #endif |
| 386 | auto api = PyUtilApiFunction("OO!O!", PyRunTimeErr, __func__); |
| 387 | static char *keywords[] = {"surface", "faces", "options", NULL}; |
| 388 | PyObject* surfaceArg; |
| 389 | PyObject* facesArg; |
| 390 | PyObject* blendOptsArg; |
| 391 | |
| 392 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, api.format, keywords, &surfaceArg, &PyList_Type, &facesArg, |
| 393 | &PyBlendOptionsType, &blendOptsArg)) { |
| 394 | return api.argsError(); |
| 395 | } |
| 396 | |
| 397 | // Get the vtkPolyData objectsfrom the Python object. |
| 398 | // |
| 399 | auto surfPolydata = GetVtkPolyData(api, surfaceArg); |
| 400 | if (surfPolydata == nullptr) { |
| 401 | return nullptr; |
| 402 | } |
| 403 | |
| 404 | // Extract blend option values from the BlendOptions object. |
| 405 | // |
| 406 | int numBlendIters = BlendOptionsGetInt(blendOptsArg, BlendOptions::NUM_BLEND_ITERATIONS); |
| 407 | int numSubblendIters = BlendOptionsGetInt(blendOptsArg, BlendOptions::NUM_SUBBLEND_ITERATIONS); |
| 408 | int numSubdivisionIters = BlendOptionsGetInt(blendOptsArg, BlendOptions::NUM_SUBDIVISION_ITERATIONS); |
| 409 | int numCgSmoothIters = BlendOptionsGetInt(blendOptsArg, BlendOptions::NUM_CGSMOOTH_ITERATIONS); |
| 410 | int numLapSmoothIters = BlendOptionsGetInt(blendOptsArg, BlendOptions::NUM_LAPSMOOTH_ITERATIONS); |
| 411 | // The API uses a percent, SV uses the value percent/100. |
| 412 | double targetDecimation = BlendOptionsGetDouble(blendOptsArg, BlendOptions::TARGET_DECIMATION) / 100.0; |
| 413 | |
| 414 | // Check values. |
| 415 | // |
| 416 | if (numBlendIters < 1) { |
| 417 | api.error("The 'num_blend_operations' parameter must be > 0."); |
| 418 | return nullptr; |
| 419 | } |
| 420 | |
| 421 | if (numSubblendIters < 1) { |
| 422 | api.error("The 'num_subblend_operations' parameter must be > 0."); |
| 423 | return nullptr; |
| 424 | } |
| 425 | |
| 426 | if (numSubdivisionIters < 0) { |
| 427 | api.error("The 'num_subdivision_operations' parameter must be >= 0."); |
| 428 | return nullptr; |
| 429 | } |
| 430 | |
| 431 | if (numCgSmoothIters < 0) { |
| 432 | api.error("The 'num_cgsmooth_iterations' parameter must be >= 0."); |
| 433 | return nullptr; |
| 434 | } |
| 435 | |
| 436 | if (numLapSmoothIters < 1) { |
nothing calls this directly
no test coverage detected