First-principles approach for the calculation of optical properties of one-dimensional systems with helical symmetry: The case of carbon nanotubes