revert: restore original debug logging logic that works

This commit is contained in:
sladro 2025-09-20 09:36:11 +08:00
parent aad395a804
commit b4b673ab8e

View File

@ -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();
}
}