From 2f1bfdebe246f749b57b865b7247052f7daf4985 Mon Sep 17 00:00:00 2001 From: Bertold Van den Bergh Date: Fri, 13 Dec 2019 16:15:25 +0000 Subject: [PATCH] Update makefile and add margin to border detection to cover rounding --- library/Makefile | 2 +- library/zonedetect.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Makefile b/library/Makefile index 2593147..7c62c1f 100644 --- a/library/Makefile +++ b/library/Makefile @@ -66,7 +66,7 @@ obj/%.o: src/%.c $(INCLUDES_SRC) clean: rm -rf $(OBJECTS_OBJ) $(EXECUTABLE) -install: +install: $(EXECUTABLE) install -m 0755 -d $(DESTDIR)$(includedir) $(DESTDIR)$(libdir) install -m 0644 -t $(DESTDIR)$(includedir) zonedetect.h ifeq ($(OS),Windows_NT) diff --git a/library/zonedetect.c b/library/zonedetect.c index 6d3e352..6f800f4 100644 --- a/library/zonedetect.c +++ b/library/zonedetect.c @@ -700,7 +700,7 @@ static ZDLookupResult ZDPointInPolygon(const ZoneDetect *library, uint32_t polyg /* Check if the target is on the border */ const int32_t intersectLon = (int32_t)(((float)latFixedPoint - b) / a); - if(intersectLon == lonFixedPoint) { + if(intersectLon >= lonFixedPoint-1 && intersectLon <= lonFixedPoint+1) { if(distanceSqrMin) *distanceSqrMin = 0; return ZD_LOOKUP_ON_BORDER_SEGMENT; }