precompute trig