Measuring polarization in the X-ray range: New simulation method for gaseous detectors