From 1d3a44a157a570abd4d474b51d41fd5dd47b1c81 Mon Sep 17 00:00:00 2001 From: supertobi Date: Thu, 7 Jan 2016 09:08:35 +0100 Subject: [PATCH] Update calcDistance.lua Add the elevation to the calculation of the distance --- contrib/calcDistance.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/calcDistance.lua b/contrib/calcDistance.lua index 807e23a..1c76c72 100644 --- a/contrib/calcDistance.lua +++ b/contrib/calcDistance.lua @@ -1,6 +1,6 @@ --[[ This file is part of darktable, - Copyright 2014 by Tobias Jakobs. + Copyright 2014-2016 by Tobias Jakobs. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ USAGE ]] local dt = require "darktable" -dt.configuration.check_version(...,{2,0,1},{3,0,0}) +dt.configuration.check_version(...,{3,0,0}) local function calcDistance() local sel_images = dt.gui.selection() @@ -71,6 +71,11 @@ local function calcDistance() local angle = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a)); local distance = earthRadius * angle; -- Distance in km + -- Add the elevation to the calculation + local elevation = 0; + elevation = math.abs(ele1 - ele2) / 1000; --in km + distance = math.sqrt(math.pow(elevation,2) + math.pow(distance,2) ); + dt.print(distance.." km")