I have bit of code that I'm trying to understand and just can't get to where it makes sense for me. If i can get where i can understand how to interate this i can figure out how to read some of the others i'm working with.
I have got thru the documentation and think i have figure out all the operators, but just can't put it together into a "If then" type expression that make sense to me.
as it's written
I added the "()" for the local Vars, and put it in Infix2Postfix and converted it back from the reverse polish notation format and got this
So i can see that if the evaluation of the expression is true it sets the "L:VectorOnGlass" flag.
I started in the middle of the () and worked out. I have used Bold Italics in places where I need help.
starting at the top:
*******************
Absolute value of (negate(radians to deg (in radians - ArcTangent2 of ( VBody X , VBody Z in meters/sec ??)))) --- I think this is right although i don't know why you would bother to negate a number you are going to take the absolute value of? also while the SDK list A:Velocity Body X as feet per second, i assume that the ",m/s" parameter request changes that to meters/sec ?
7 < -- would this read, previous is (less than) < 7 ?? or does the < connect to the next section of the expression as in "previous < following" ?
then....
Negate(radians to Deg(in radians - ArcTangent2 of ( VBody Y , VBody Z in meters/sec ??)))
11.5 < & & -- I am totally confused here please help. Does the double & mean , if the previous is true AND the following is True ??
then....
Negate(radians to Deg(in radians - ArcTangent2 of ( VBody Y , VBody Z in meters/sec ??)))
-5.5 > & - greater than something ? I can't get a grip on the "&" thing and how it connect things together
if & -- If True
set flag to 1
else
set flag to 0
************************
If someone could please fill in the blanks for me here and set me on the right path.
thanks
Joel
I have got thru the documentation and think i have figure out all the operators, but just can't put it together into a "If then" type expression that make sense to me.
as it's written
Code:
(A:VELOCITY BODY X, m/s) (A:VELOCITY BODY Z, m/s) atg2 rddg /-/ abs 7 < (A:VELOCITY BODY Y, m/s) (A:VELOCITY BODY Z, m/s) atg2 rddg /-/ 11.5 < && (A:VELOCITY BODY Y, m/s) (A:VELOCITY BODY Z, m/s) atg2 rddg /-/ -5.5 > && if{ 1 (>(L:VectorOnGlass, enum))} els{ 0 (>(L:VectorOnGlass, enum)) }
I added the "()" for the local Vars, and put it in Infix2Postfix and converted it back from the reverse polish notation format and got this
Code:
abs( ( /-/ rddg( atg2( (A:VELOCITY BODY X , m/s),(A:VELOCITY BODY Z , m/s) ) ) ) ) 7 < ( /-/ rddg( atg2( (A:VELOCITY BODY Y , m/s),(A:VELOCITY BODY Z , m/s) ) ) ) 11.5 < & & ( /-/ rddg( atg2( (A:VELOCITY BODY Y , m/s),(A:VELOCITY BODY Z , m/s) ) ) ) -5.5 > &
if &
{ 1 > (L:VectorOnGlass , enum)
} else
{ 0 > (L:VectorOnGlass , enum)
}
So i can see that if the evaluation of the expression is true it sets the "L:VectorOnGlass" flag.
I started in the middle of the () and worked out. I have used Bold Italics in places where I need help.
starting at the top:
*******************
Absolute value of (negate(radians to deg (in radians - ArcTangent2 of ( VBody X , VBody Z in meters/sec ??)))) --- I think this is right although i don't know why you would bother to negate a number you are going to take the absolute value of? also while the SDK list A:Velocity Body X as feet per second, i assume that the ",m/s" parameter request changes that to meters/sec ?
7 < -- would this read, previous is (less than) < 7 ?? or does the < connect to the next section of the expression as in "previous < following" ?
then....
Negate(radians to Deg(in radians - ArcTangent2 of ( VBody Y , VBody Z in meters/sec ??)))
11.5 < & & -- I am totally confused here please help. Does the double & mean , if the previous is true AND the following is True ??
then....
Negate(radians to Deg(in radians - ArcTangent2 of ( VBody Y , VBody Z in meters/sec ??)))
-5.5 > & - greater than something ? I can't get a grip on the "&" thing and how it connect things together
if & -- If True
set flag to 1
else
set flag to 0
************************
If someone could please fill in the blanks for me here and set me on the right path.
thanks
Joel