Described embodiments include a method for use with a catheterthat includes at least one flexible arm to which are coupled aplurality of electrodes.The method includes calculating, by aprocessor, respective estimated locations of the electrodes whilethe catheter is within a portion of a body of a subject, fitting amodel of the catheter, which models the flexible arm as apiecewise-linear element that includes a plurality of linearsegments, to the estimated locations, ascertaining for each of theelectrodes, based on respective orientations of one or more of thelinear segments per the fitting, whether the electrode is incontact with tissue of the subject, and updating a map of theportion of the body of the subject, in response to ascertainingthat at least one of the electrodes is in contact with the tissue.Other embodiments are also described.