Moved trig calculations into constructor so they're only computed once.