diff options
author | Théo de la Hogue | 2024-04-25 22:11:44 +0200 |
---|---|---|
committer | Théo de la Hogue | 2024-04-25 22:11:44 +0200 |
commit | 8252697b266ffd2e6552d6a8bc70e659f58e014b (patch) | |
tree | 48280593361bb72d6074c9209adbfe94750c5fcc | |
parent | 8b97c9949fce67239a2ee01a5591e11767c5dd87 (diff) | |
download | argaze-8252697b266ffd2e6552d6a8bc70e659f58e014b.zip argaze-8252697b266ffd2e6552d6a8bc70e659f58e014b.tar.gz argaze-8252697b266ffd2e6552d6a8bc70e659f58e014b.tar.bz2 argaze-8252697b266ffd2e6552d6a8bc70e659f58e014b.tar.xz |
Testing polygon validity before to proceed at circle intersection.
-rw-r--r-- | src/argaze/AreaOfInterest/AOIFeatures.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/argaze/AreaOfInterest/AOIFeatures.py b/src/argaze/AreaOfInterest/AOIFeatures.py index 065fd64..c2714ca 100644 --- a/src/argaze/AreaOfInterest/AOIFeatures.py +++ b/src/argaze/AreaOfInterest/AOIFeatures.py @@ -17,6 +17,7 @@ __credits__ = [] __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" __license__ = "GPLv3" +import logging import json import math from typing import Self @@ -232,6 +233,15 @@ class AreaOfInterest(numpy.ndarray): assert (self.dimension == 2) self_polygon = Polygon(self) + + if not self_polygon.is_valid: + + logging.warning('AreaOfInterest.circle_intersection: AOI polygon is not valid.') + + empty_array = numpy.array([list([])]).astype(numpy.float32).view(AreaOfInterest) + + return empty_array, 0., 0. + args_circle = Point(center).buffer(radius) if self_polygon.intersects(args_circle): |