trig preprocessing