udfGoldenSection
flt udfGoldenSectionV1 (int/flt, int/flt)
flt udfGoldenSectionV2 (int/flt, int/flt)
flt udfGoldenWidthFromHeight (int/flt)
flt udfGoldenHeightFromWidth (int/flt)
#DefineFunction udfGoldenSectionV2 (fltWidth, fltHeight)
arrGS = ArrDimension (2)
arrGS[0] = @GOLDENRATIO * fltHeight
arrGS[1] = fltWidth / @GOLDENRATIO
Return arrGS
; k = 1.61803398874989484820458683436564 ; k = 0.5 * (1 + (5 ** 0.5))
#EndFunction


#DefineFunction udfGoldenSectionV1 (fltWidth, fltHeight)
Return @GOLDENRATIO * fltHeight : @TAB : fltWidth / @GOLDENRATIO
; k = 1.61803398874989484820458683436564 ; k = 0.5 * (1 + (5 ** 0.5))
#EndFunction


#DefineFunction udfGoldenWidthFromHeight (fltHeight)
Return @GOLDENRATIO * fltHeight
#EndFunction


#DefineFunction udfGoldenHeightFromWidth (fltWidth)
Return fltWidth / @GOLDENRATIO
#EndFunction



; Test.

strMsgtitle = "Demo  udfGoldenSection (fltWidth, fltHeight)"

fltWidth = 200.0
fltHeight = 100.0

strGoldenSection = udfGoldenSectionV1 (fltWidth, fltHeight) ; Tabbed list with 2 Elements: "161.80339887@TAB123.60679775".
fltGoldenWidth1 = ItemExtract (1, strGoldenSection, @TAB)
fltGoldenHeight1 = ItemExtract (2, strGoldenSection, @TAB)

arrGoldenSection = udfGoldenSectionV2 (fltWidth, fltHeight) ; Dim-1 Array with 2 Elements: "161.80339887|123.60679775".
fltGoldenWidth2 = arrGoldenSection[0]
fltGoldenHeight2 = arrGoldenSection[1]


fltGoldenWidth = udfGoldenWidthFromHeight (fltHeight)
fltGoldenHeight = udfGoldenHeightFromWidth (fltWidth)


strMsgtext = "Picture dimensions raw:" : @LF
strMsgtext = strMsgtext : "fltWidth x fltHeight" : @TAB : " = " : fltWidth : " x " : fltHeight : @LF : @LF
strMsgtext = strMsgtext : "Golden Section:" : @LF
strMsgtext = strMsgtext : "fltWidth x fltHeight" : @TAB : " = " : fltGoldenWidth2 : " x " : fltGoldenHeight2 : @LF : @LF
strMsgtext = strMsgtext : "fltWidth x fltHeight" : @TAB : " = " : fltGoldenWidth : " x " : fltGoldenHeight : @LF
Message (strMsgtitle, strMsgtext)

Exit
;----------------------------------------------------------------------------------------------------
; (c)Detlev Dalitz.20020626.20100206.
;----------------------------------------------------------------------------------------------------