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.
Asked
Active
Viewed 29 times
0
-
How is this different from your other post (https://math.stackexchange.com/questions/4374116/equation-of-a-line-that-connects-two-points) ? – blamocur Feb 05 '22 at 00:06
-
Because it is. I decided that I may try spherical coordinates and I wanted to some help to try and figure out how to generate the angles. Asking questions is what this site is all about after all. – UnSure Feb 05 '22 at 00:12
-
Forget spherical coordinates! Use the following cartesian expressions : $x=(1-t)x_1+tx_2, y=ty_1+(1-t)y_2, z=tz_1+(1-t)z_2$ where $P_1(x_1,y_1,z_1)$, $P_2(x_2,y_2,z_2)$ with time t varying (by steps $\Delta t$) from $0$ to $1$. – Jean Marie Feb 05 '22 at 00:14
-
What do you mean by t being the change in steps from 0 to 1? Can my step interval be different? Also what do you mean by tx2? Why is there a different step count for each set of coordinates? – UnSure Feb 05 '22 at 00:29
-
Also where do you enter your initial coordinates into? – UnSure Feb 05 '22 at 00:57
-
Perhaps by "iterate down the line" you are trying to parameterize the points on the line. Your example involves a line (or line segment?) in three dimensions. To that extent the proposed duplicate target is a match, but you have introduced the idea of using spherical coordinate (without much motivation other than to change the problem). Indeed one could parameterize the spherical coordinates by converting the parameterized Cartesian coordinates. If you try to do this and run into some difficulty, explaining that in the body of your Question would be a significant improvement. – hardmath Feb 20 '22 at 00:53