This paper presents a three-dimensional shape-reconstructing algorithm applied on a shape sensing system based on a polyimide-coated 7-core optical fiber. Fiber optic-based shape sensing consists in numerically evaluating the strains applied to the fiber in order to identify useful spatial parameters such as the curvature radii defining its shape. Multicore fibers are preferable since they can also provide information regarding the direction of bending. The proposed method relies on the homogeneous transformation matrices normally used in robotics, which can express the position of a point in different frames, i.e. from local to global coordinates. The results are shown for both a two-dimensional and a three-dimensional configuration, achieving an average relative error of 0.23% and 0.19% of the total length respectively. The small computation time (0.0023 s) makes this algorithm suitable for real-time shape reconstructions in a variety of engineering fields.