|
[Sponsors] |
December 22, 2020, 18:27 |
'If' and 'and' statements on CFD-Post
|
#1 |
New Member
Elías Bracho
Join Date: Dec 2020
Posts: 2
Rep Power: 0 |
Hello everyone, I am having some trouble programming an expression for calculating the theta angle variable in a circumference. As it is known, the angle in a rectangle triangle can be calculated with the function theta = ATAN(Y/X). Now, for the 4 quadrants in a circumference this expression may vary, since X and Y change their signs.
What I want to programme with the 'if' statement is something like this if X>0 and Y>0, then theta=ATAN(Y/X) (1st quadrant) if X<0 and Y>0, then theta=ATAN(Y/X) + 90 (2nd quadrant) if X<0 and Y<0, then theta=ATAN(Y/X) +180 (3rd quadrant) if X>0 and Y<0, then theta=ATAN(Y/X) + 270 (4th quadrant) I know the 'if' statement works like this on CFD-Post: if(condition, result when true, result when false), however, my problem is that I have two conditions for each of the four cases and haven't been able to relate them in the 'condition' part of the 'if' statement , as I mentioned before. I appreciate any tip or help. Thank you, Elias |
|
|
|