A method includes receiving time-varying boundary condition values measured for a probe inside a cavity of an organ of a patient. A time-dependent shape of the probe is calculated by (a) representing sections of the probe as first springs, (b) representing external forces acting on the sections as second springs, and (c) solving a set of coupled equations of motion, for the first springs and the second springs, so as to meet the time-varying boundary condition values. The shape is presented to a user.