Hi,

I'm triying to transform a vector field which is expressed with u and v
componants in the same vector field expressed with velocity and direction.I 
have difficulties to obtain the direction.

I use a (big) Compute module which tests every data and constructs the new
vector.There is no problem if the first componant of the vectors is never null,
the values seems correct (all between 0 and 360).But is there is a zero, an 
error occurs because I try to divide by 0.

I don't understand why Compute doesn't make correctly the tests whereas it
was correct the first time. Is it because it works with all the field?
I can't find a way to do it differently.

This is my Compute expression :

(a.x>0 && a.y>=0) ? (180+90-atan(a.y/a.x)/deg) : ((a.x<0 && a.y>=0) ?
(90+atan(a.y/(-a.x))/deg) : ((a.x<0 && a.y<0) ?
(90-atan((-a.y)/(-a.x))/deg) : ((a.x>0 &&a.y<0) ?
(270+atan((-a.y)/a.x)/deg) : (a.x==0 && a.y>0) ? 180 : 0)))
where deg = 3.1415926535 / 180.0

Can anybody help me?


Emmanuelle Lafont


Reply via email to