copied convertOpticsAC from m3v4n5