fix: correct occlusion algorithm logic in shell analysis
- Change sorting from farthest-first to nearest-first (minProj ascending) - Fix occlusion boundary initialization from +infinity to -infinity - Correct visibility logic: near components occlude far components - Use max() for boundary update to ensure monotonic increase This fixes the issue where internal components were getting too many votes by ensuring occlusion detection follows physical reality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
ad226e63a5
commit
8ea0d9ce09
@ -2820,21 +2820,21 @@ CreoManager::ProjectionAnalysisData CreoManager::PerformMultiDirectionalProjecti
|
||||
projections.push_back({minProj, maxProj, comp.featureId});
|
||||
}
|
||||
|
||||
// Sort by maximum projection value (farthest first)
|
||||
// Sort by minimum projection value (nearest first)
|
||||
std::sort(projections.begin(), projections.end(),
|
||||
[](const ProjectionData& a, const ProjectionData& b) {
|
||||
return a.maxProj > b.maxProj;
|
||||
return a.minProj < b.minProj;
|
||||
});
|
||||
|
||||
// Occlusion detection: only unoccluded components are visible
|
||||
double occlusionBoundary = std::numeric_limits<double>::max();
|
||||
// Occlusion detection: near components occlude far components
|
||||
double occlusionBoundary = -std::numeric_limits<double>::max();
|
||||
|
||||
for (const auto& proj : projections) {
|
||||
// If component's farthest point is in front of occlusion boundary, it's visible
|
||||
if (proj.maxProj < occlusionBoundary) {
|
||||
// If component's nearest point is beyond occlusion boundary, it's visible
|
||||
if (proj.minProj > occlusionBoundary) {
|
||||
result.visibilityVotes[proj.featureId]++;
|
||||
// Update occlusion boundary to this component's nearest point
|
||||
occlusionBoundary = proj.minProj;
|
||||
// Update occlusion boundary to this component's farthest point
|
||||
occlusionBoundary = std::max(occlusionBoundary, proj.maxProj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user