From a30cf00d494068db3302f9fef232ea8894b44562 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Tue, 4 Jun 2024 09:06:10 -0400 Subject: [PATCH] Update c2_pub_sub.py --- skyscan-c2/c2_pub_sub.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/skyscan-c2/c2_pub_sub.py b/skyscan-c2/c2_pub_sub.py index c10ae05..7bb2665 100644 --- a/skyscan-c2/c2_pub_sub.py +++ b/skyscan-c2/c2_pub_sub.py @@ -401,9 +401,19 @@ def _elevation_check(self: Any, azimuth: float, elevation: float) -> bool: Returns: bool: True if the elevation is within the acceptable range """ + + # Check if Occlusion Mapping is enabled + # Occlusion is designed for structures that come up from the horizon and block the view of the camera. + # It doesn't work for overhanging things. if self.occlusion_mapping_enabled: - for obj in self.occlusion_mapping: - if obj["azimuth"] > azimuth: + + # Go through all of the Occlusion Mapping Points + for i, obj in enumerate(self.occlusion_mapping): + # Check if the Azimuth(Pan) is greater or if this is the last point. If it is the last point, + # then we can assume it applies to the end of the pan (360) + if (obj["azimuth"] > azimuth) or (i == len(self.occlusion_mapping) - 1): + + # If the Occlusion Point elevation is greater than the current elevation, then it is occluded. if obj["elevation"] > elevation: return False else: