hi,
i'm pretty new in scripting and i'm wonering how i can map one domain {0 to 3} to another {0 to 1}. so if the value 1.5 the new/mapped value would be 0.5. i know there is a command in processing which is called "map(value, start_target, end_target, start, end)" but it doesn't work in the vb/c#-component...
vbPrivate Sub RunScript(ByVal x As List(Of Double), ByVal lichtehoehe As Object, ByRef A As Object)
Dim i, x_length As int32
Dim temp As Double
Dim ausgabe(x.count-1) As Double
x_length = x.count - 1
For i = 0 To x_length
temp = 0 + x(i)
temp = map(temp, 0, 1, 0, lichtehoehe)
ausgabe(i) = temp
Next
a = ausgabe
c# private void RunScript(List<int> x, int lichtehoehe, ref object A)
{
int temp = 0;
int x_length = x.Count - 1;
int[] ausgabe = new int[x.Count];
for (int i = 0;i < x_length; i++)
{
temp = 0 + x[i];
temp = map(temp, 0, 1, 0, lichtehoehe);
ausgabe[i] = temp;
}
A = ausgabe;
}
thank you for your helpboris