Precalculate some sin and cos to reduce floating-point ops.