I need a function calc the cyclometric distance between 3 numbers , the number must b from 1 to 90 , on array of 3 element
and the distance must be equal to nvalore for esample 1
this to create the array
FUNCTION distanza_ciclometrica(nvalore)
local aTmp := {}
local i, j, k
FOR i := 1 TO 90
FOR j := i+1 TO 90
FOR k := j+1 TO 90
nTemp := distance(i, j, k)
IF nTemp == nvalore
AaDd(aTmp, {i, j, k})
ENDIF
NEXT
NEXT
NEXT
RETURN aTmp
this the function calc distance
FUNCTION distance(n1, n2, n3)
local nMin := n1
local nMax := n1
local nTemp
IF n2 < nMin
nMin := n2
ENDIF
IF n3 < nMin
nMin := n3
ENDIF
IF n2 > nMax
nMax := n2
ENDIF
IF n3 > nMax
nMax := n3
ENDIF
nTemp := (nMax - nMin) % 90
IF nTemp > 45
nTemp := 90 - nTemp
ENDIF
RETURN nTemp
the chatGpt have made also another function But I not understood how compile it
#include "math.hbp"
FUNCTION distance(n1, n2, n3)
local nMin := math.min(n1, n2, n3)
local nMax := math.max(n1, n2, n3)
local nTemp := (nMax - nMin) % 90
nTemp := IIF(nTemp > 45, 90 - nTemp, nTemp)
RETURN nTemp
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com