I am trying to write a program that constructs a trajectory from an intial position [x1,y1,z1] to an end position that passes through a series of intermediate points. e.g. the program accepts three arrays x=[1,6,2,5,3], y=[4,1,6,4,1,1] and z=[9,5,1,5,1,2]. From what I can gather, cubic splines could be implemented in order to achieve this, however I'm not sure if this is the most suitable approach. Does any one have any alternative options? I've managed to find examples of cubic splines in 2 dimensions (i.e. x and y directions) but none that are applied to three axes and if this is the correct approach, I am not sure how to extrapolate this to 3 dimensions. If someone could provide an explanation and example, I would be very greatful! Essentially, I am aiming to write a program that iterates through the spline incrementally so as to achieve a smooth trajectory that could be followed by a simulated robot.