1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-05 00:16:16 +00:00

dont require heading for point.closest

This commit is contained in:
kepler155c@gmail.com 2019-01-08 04:40:58 -05:00
parent f5294d4fce
commit b761b3429a

View File

@ -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 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