Polarization ray tracing in anisotropic optically active media. I. Algorithms