using prototype chain approach with classes for points and trajectories