An apparatus for controlling the movement of a catheter-like tool to beinserted into thebody of a patient. The apparatus comprises a controllable magnetic fieldsource for generating afirst magnetic field outside the body, the controllable magnetic field sourcehaving a firstelectromagnet cluster and a second electromagnet cluster, the first clustersubstantiallyopposed to said second cluster a tool having a distal end responsive to themagnetic fieldwherein the distal end comprises a magnetic element positioned therein andwherein themagnetic element in the distal end has a second magnetic field associatedtherewith one ormore magnetic sensors to sense the second magnetic field produced by thedistal end todetermine a current position of the distal end is determined based on themagnitude of aresultant force vector (B) generated by the controllable magnetic field sourceand further basedon the direction of the force vector 8 wherein the magnitude of the resultantforce vector B isdetermined from three orthogonal components (Bx, BY, Bz) associated with atleast sixelectromagnets in the first and second clusters, wherein the magnitude of theresultant forcevector B is given by the equation:B = .sqroot.(Bx2 + By2 + Bz2), and wherein the direction of the resultantforce vector B isdetermined with at least three resultant angles between three orthogonalcomponents withthe following equations:.alpha. = (cos-1Bx)/B, .beta. = (cos-1By)/B, .delta. = (cos-1Bz)/B and asystem controller that isconfigured to process the current position of the distal end obtained by themagneticsensors to compute a position error between a desired position of the distalend and currentposition of the distal end wherein the system controller is further configuredto alter thecontrollable magnetic field source to provide a position and command input toalter thelocation of the tool distal end position based on the position error.