calculate tool position