Calculate difference between angle with an array
in
Programming Questions
•
7 months ago
Hi all,
I am totally new at processing and programming in java, so the question is maybe stupid, but I can't solve it right now.
I have a variable, which represents an angle. With a slider I am able to control the angle, so everytime I use the slider the variable gets a new value. And I want to calculate the difference between the actual angle and the angle before.
So I tried to work with an array, but the second array-value is always "0".
I am totally new at processing and programming in java, so the question is maybe stupid, but I can't solve it right now.
I have a variable, which represents an angle. With a slider I am able to control the angle, so everytime I use the slider the variable gets a new value. And I want to calculate the difference between the actual angle and the angle before.
So I tried to work with an array, but the second array-value is always "0".
-
float[] angle2 = new float[2];
-
int n,i;
- void uebergabe()
{
angle2[n] = 180-degrees(arm2_angle);
if (angle2[0] > angle2[1]) {
arm2_angle_diff = angle2[0]-angle2[1];
}arm2_angle_diff = angle2[1]-angle2[0];
else if (angle2[0] < angle2[1]) {
} -
}
Hope you guys can help me, I should be simple I think :)
Thank you.
1