We address the problem of computing the deformed configuration of a drillstring, constrained to deform inside a curved borehole. This problem is encountered in applications such as torque-and-drag and directional drilling. In contrast to the traditional Lagrangian approach, the deformed drillstring is described by means of the distance from the borehole axis, in terms of the curvilinear coordinate defined along the borehole. This model is further implemented within a segmentation algorithm where the borehole and the drillstring are divided into segments limited by contacts, which interestingly transforms the problem into a sequence of analogous auxiliary problems. This Eulerian view of the drillstring flow into the borehole resolves in one stroke a series of issues that afflict the classical Lagrangian approach: (i) the contact detection is reduced to checking whether a threshold on the distance function is violated, (ii) isoperimetric conditions are transformed into regular boundary conditions, instead of being treated as external integral constraints, (iii) the method yields a well-conditioned set of equations that does not degenerate with decreasing flexural rigidity of the drillstring and/or decreasing clearance between the drillstring and the borehole. Theoretical developments related to this Eulerian formulation of the drillstring are presented, along with an example illustrating the advantages of this approach.