| 392 | } |
| 393 | |
| 394 | void SelectionController::classifyPointCloud(const MVS::PointCloud& pointcloud, const Camera& camera) { |
| 395 | // If no current selection path, nothing to classify |
| 396 | if (selectionPath.empty()) |
| 397 | return; |
| 398 | |
| 399 | // Initialize selection buffer if needed |
| 400 | if (pointsSelected.size() != pointcloud.points.size()) |
| 401 | pointsSelected.resize(pointcloud.points.size(), false); |
| 402 | |
| 403 | // Create temporary buffer for this selection |
| 404 | std::vector<bool> currentSelection; |
| 405 | currentSelection.reserve(pointcloud.points.size()); |
| 406 | |
| 407 | // Classify points in current selection |
| 408 | for (const auto& point : pointcloud.points) |
| 409 | currentSelection.push_back(isPointInSelection(point, selectionPath, currentMode, camera)); |
| 410 | |
| 411 | // Apply the operation based on modifier keys |
| 412 | SelectionOperation operation = OP_REPLACE; |
| 413 | if (pendingSelectionIsAdditive) { |
| 414 | operation = OP_ADD; |
| 415 | } else if (pendingSelectionIsSubtractive) { |
| 416 | operation = OP_SUBTRACT; |
| 417 | } |
| 418 | |
| 419 | // Update the final selection based on operation |
| 420 | for (size_t i = 0; i < pointcloud.points.size(); ++i) { |
| 421 | if (currentSelection[i]) { |
| 422 | if (operation == OP_REPLACE || operation == OP_ADD) { |
| 423 | pointsSelected[i] = true; |
| 424 | } else if (operation == OP_SUBTRACT) { |
| 425 | pointsSelected[i] = false; |
| 426 | } |
| 427 | } else if (operation == OP_REPLACE) { |
| 428 | // For replace operation, clear points not in selection |
| 429 | pointsSelected[i] = false; |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | void SelectionController::classifyMesh(const MVS::Mesh& mesh, const Camera& camera) { |
| 435 | // If no current selection path, nothing to classify |