LinearlySpacedValue
Posted: Sun Sep 12, 2010 8:45 pm
Hello everyone,
Ok A tiny macro today to calculate linearly spaced value between a Min and Max value.
Best regards.
Guimauve
Ok A tiny macro today to calculate linearly spaced value between a Min and Max value.
Best regards.
Guimauve
Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : LinearlySpacedValue
; File Name : LinearlySpacedValue.pb
; File version: 1.0.0
; Programmation : OK
; Programmed by : Guimauve
; Date : 12-09-2010
; Mise à jour : 12-09-2010
; PureBasic cade : 4.51
; Plateform : Windows, Linux, MacOS X
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Macro LinearlySpacedValue(IncrementID, IncrementMax, MinValue, MaxValue)
(MinValue + (MaxValue - MinValue) * (IncrementID / IncrementMax))
EndMacro
IncrementMax = 15
a.d = 4.0 ; +/- Radius
b.d = 6.0 ; +/- Stretching
Decimal.b = 6
Debug "; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
Debug "; Horopter curve approximation"
Debug ""
Debug "[x, y, z]"
For Index = 0 To IncrementMax
t.d = LinearlySpacedValue(Index, IncrementMax, -#PI, #PI)
Debug "[" + StrD((2*a)/(1+t*t), 6) + ", " + StrD(b*t, 6) + ", " + StrD((2*a*t)/(1+t*t), 6) + "]"
Next
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<