Can spherical coordinates be used to trace a line between 2 points?

30 Views Asked by At

I am trying to figure out how to trace a path between two points with my goal being to enter this info into a computer program in order to iterate down the line. My first thought was to use spherical coordinates (Maybe there is a better way to do this but idk). As an example lets say our initial point is (20, 50, -10) and our second point is (21, 51, -13) with the first number representing x, the second number representing y, and the third number representing z. In this example lets also assume that x an z operate in the horizontal plane while y operates in the vertical plane. My goal now is to figure out the three equations so that a loop can iterate down the "line" (using a constant interval which we can call r). I know that each need to be weighted properly so that it moves in the correct direction (while considering that the second point can be in any quadrant relative to our first point which we can call our origin). The main problem I am having is figuring out how to make the angles so that multiplying r by the x, y, and z angles properly weights them to ensure that the coordinate furthest away increases the quickest while the coordinate that is most similar to the starting point progresses slower in order to properly increment through the line.