The inherent flexibility, the small dimensions as well as the curvilinear shape of continuum robots makes it challenging to precisely measure their shape. Optical fibers with Bragg gratings (FBGs) provide a powerful tool to reconstruct the centerline of continuum robots. We present a theoretical model to determine the shape of such a sensor array based on longitudinal strain measurements and incorporating bending, twisting, and elongation. To validate our approach, we conduct several simulations by calculating arbitrary shapes based on the Cosserat rod theory. Our algorithm showed a maximum mean relative shape deviation of 0.04%, although the sensor array was twisted up to 78 degrees. Because we derive a closed-form solution for the strain curvature twist model, we also give analytical sensitivity values for the model, which can be used in the calculation of error propagation.