I have a series of equations to create corner points to make rotated polygons based on angles in the attribute table, but I have created it in excel and can't figure out the syntax to get it to work properly in the field calculator. I have 8 different trigonometric formulas to create XY coordinates for the 4 corner points. One of them is as follows:


Once I understand the syntax for one, I should be able to use it for the other 7 formulas, even though they vary slightly.
Can anyone advise the best way to use this formula in field calculator? Thanks.

Edit, after receiving @Paul's answer:

I figured out the correct syntax of some of the other ones, but two of them are still giving me trouble. One is producing a different result than Excel and one is saying that the syntax is incorrect.



I think it has to do with the negative signs and me probably putting them in the wrong spot...

  • Are Angle and X your only two variables?
    – Paul
    Aug 4, 2013 at 23:09
  • @Paul yeah. i'm going to have to do it for Y, too, but that will be in a separate field. everything else is just the calculation. Aug 4, 2013 at 23:13

1 Answer 1


All of the trigonometric functions you need are in the math module. I presume you'll want atan2() which is the equivalent of atan(y/x). For the mod function, you'll need to use the percent symbol.

Each function also has a simplified version (a) since you are calculating some constants. They're identical functions but will be faster.




from math import cos, atan2, radians, sqrt
from math import cos, radians #Use this for simplified functions as others aren't needed.

def trigfunc1(angle, x):
    return cos(atan2(1500,2250) + radians((360-(angle+270))%360)) * sqrt(1500**2+2250**2) + x

def trigfunc1a(angle, x):
    return cos(0.5880026035475675 + radians((90-angle)%360)) * 2704.163456597992 + x

def trigfunc2(a, x):
    return cos(radians(270) - atan2(750,1500) + radians((360-(a+270)%360))) * sqrt(1500**2+750**2) + x

def trigfunc2a(a, x):
    return cos(4.2487413713838835 + radians((90-a)%360)) * 1677.0509831248423 + x

def trigfunc3(a, x):
    return cos(-atan2(1500,2250) + radians((360-(a+270)%360))) * sqrt((1500**2)+(2250**2)) + x

def trigfunc3a(a, x):
    return cos(-0.5880026035475675 + radians((90-a)%360)) * 2704.163456597992 + x


trigfunc1(!Angle!, !X!)
trigfunc2(!A!, !X!)
trigfunc3(!A!, !X!)
  • Ahh! Perfect! Thank you so much! The only thing is the first x in (x+270) actually needed to be angle, but with that change it works perfectly. I probably should consider learning python one of these days... Aug 4, 2013 at 23:35
  • @katzendoodle, yeah I just noticed that. Fixed, thanks. If you have issues with the other formulas, you can edit them into your post and drop me a comment here.
    – Paul
    Aug 4, 2013 at 23:37
  • I posted two other formulas because they were giving me trouble...I got all of the other ones, though. Thanks. Aug 5, 2013 at 0:03
  • @katzendoodle, those should work.
    – Paul
    Aug 5, 2013 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.