Greg_Deckler's avatar
Greg_Deckler
Community Champion
8 years ago

Cartesian 2 Polar

These two measures convert Cartesian coordinates to polar coordinates. Both take two parameters, x and y, which are Cartesian coordinates.

 

r = SQRT(POWER(MAX([x]),2)+POWER(MAX([y]),2))

 

theta =
SWITCH(TRUE(),
            MAX([x])>0, ATAN(MAX([y])/MAX([x])),
            MAX([x])<0 && MAX([y])>=0, ATAN(MAX([y])/MAX([x]))+PI(),
            MAX([x])<0 && MAX([y])<0, ATAN(MAX([y])/MAX([x]))-PI(),
            MAX([x])=0 && MAX([y])>0,PI()/2,
            MAX([x])=0 && MAX([y])<0,-1*PI()/2,
            BLANK()
)

 

No RepliesBe the first to reply