From b761b3429a02c25b8a1256fa26f8e33698f1fa63 Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Tue, 8 Jan 2019 04:40:58 -0500 Subject: [PATCH] dont require heading for point.closest --- sys/apis/point.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/apis/point.lua b/sys/apis/point.lua index f36933b..690b446 100644 --- a/sys/apis/point.lua +++ b/sys/apis/point.lua @@ -177,7 +177,12 @@ function Point.closest(reference, pts) local lm, lpt = math.huge for _,pt in pairs(pts) do local distance = Point.turtleDistance(reference, pt) - if distance < lm then + if not reference.heading then + if distance < lm then + lpt = pt + lm = distance + end + elseif distance < lm then local _, _, m = Point.calculateMoves(reference, pt, distance) if m < lm then lpt = pt