Factor trig lookups into `util.py`.