From b4b673ab8e52251e22c3bb83779e649145794378 Mon Sep 17 00:00:00 2001 From: sladro Date: Sat, 20 Sep 2025 09:36:11 +0800 Subject: [PATCH] revert: restore original debug logging logic that works --- CreoManager.cpp | 45 ++++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/CreoManager.cpp b/CreoManager.cpp index bf5acc3..7fffb9d 100644 --- a/CreoManager.cpp +++ b/CreoManager.cpp @@ -2914,13 +2914,19 @@ CreoManager::ProjectionAnalysisData CreoManager::PerformMultiDirectionalProjecti } } - // Debug output for specific component - bool isDebugComponent = false; + // Perform ray verification from global center if (targetComponent) { - isDebugComponent = (targetComponent->name.find("12v4000g03_herhang") != std::string::npos || - targetComponent->name.find("12V4000G03_HERHANG") != std::string::npos); + bool rayBlocked = IsComponentBlockedFromCenter(globalCenter, *targetComponent, result.components); - if (isDebugComponent) { + if (!rayBlocked) { + // Component passed both 2D projection and ray verification + result.visibilityVotes[componentId]++; + } + // If blocked by ray test, this direction votes 0 (no increment) + + // Debug output for specific component + if (targetComponent->name.find("12v4000g03_herhang") != std::string::npos || + targetComponent->name.find("12V4000G03_HERHANG") != std::string::npos) { static bool firstTime = true; if (firstTime) { try { @@ -2962,22 +2968,8 @@ CreoManager::ProjectionAnalysisData CreoManager::PerformMultiDirectionalProjecti firstTime = false; } catch (...) {} } - } - } - // Perform ray verification from global center - bool rayBlocked = false; - if (targetComponent) { - rayBlocked = IsComponentBlockedFromCenter(globalCenter, *targetComponent, result.components); - - if (!rayBlocked) { - // Component passed both 2D projection and ray verification - result.visibilityVotes[componentId]++; - } - // If blocked by ray test, this direction votes 0 (no increment) - - // Log ray verification result for debug component - if (isDebugComponent) { + // Append visibility data for each direction try { SessionInfo sessionInfo = GetSessionInfo(); if (sessionInfo.is_valid) { @@ -3001,15 +2993,10 @@ CreoManager::ProjectionAnalysisData CreoManager::PerformMultiDirectionalProjecti << ", ratio=" << visibilityRatio << ", visible=" << (visibilityRatio >= SHELL_ANALYSIS_MIN_VISIBLE_RATIO_PER_DIR ? "YES" : "NO") << std::endl; - if (visibilityRatio >= SHELL_ANALYSIS_MIN_VISIBLE_RATIO_PER_DIR) { - logFile << "Ray Test: from (" << globalCenter.x << ", " << globalCenter.y << ", " << globalCenter.z - << ") to (" << componentCenter.x << ", " << componentCenter.y << ", " << componentCenter.z << ")" << std::endl; - logFile << "Ray Result: " << (rayBlocked ? "BLOCKED (internal)" : "CLEAR (outer shell)") << std::endl; - logFile << "Final Vote: " << (rayBlocked ? "NO (0)" : "YES (1)") << std::endl; - } else { - logFile << "Ray Test: SKIPPED (not visible in 2D)" << std::endl; - logFile << "Final Vote: NO (0)" << std::endl; - } + logFile << "Ray Test: from (" << globalCenter.x << ", " << globalCenter.y << ", " << globalCenter.z + << ") to (" << componentCenter.x << ", " << componentCenter.y << ", " << componentCenter.z << ")" << std::endl; + logFile << "Ray Result: " << (rayBlocked ? "BLOCKED (internal)" : "CLEAR (outer shell)") << std::endl; + logFile << "Final Vote: " << (rayBlocked ? "NO (0)" : "YES (1)") << std::endl; logFile.close(); } }