How can I improve this equation to work in all cases?

  • Context: High School 
  • Thread starter Thread starter pjhphysics
  • Start date Start date
  • Tags Tags
    Dimensions Line
Click For Summary

Discussion Overview

The discussion revolves around finding the coordinates of a third point on a line defined by two given points in three-dimensional space, specifically when the Z-coordinate is set to 30. Participants explore various mathematical approaches, including parametric equations, vector forms, and geometric reasoning, while seeking a straightforward implementation for programming purposes.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant suggests parameterizing the line through the two points and deriving linear formulas for each coordinate.
  • Another participant requests clarification on the linear formula and asks for a demonstration of the setup.
  • A different approach is presented using vector notation, leading to a formula for Z and a method to find the corresponding X and Y values.
  • One participant describes a geometric method involving projection onto axes and solving a triangle relationship to find the coordinates.
  • Another participant proposes a simple percentage-based calculation to determine the coordinates based on the relative distances along the Z-axis.
  • One participant expresses concern that their derived equations work in some cases but not others, suggesting a potential need for absolute value notation in their calculations.

Areas of Agreement / Disagreement

Participants present multiple competing views and methods for solving the problem, with no consensus on a single approach or solution. Some methods are preferred for their simplicity, while others are critiqued for their limitations in certain cases.

Contextual Notes

Some methods rely on specific assumptions about the relationship between the coordinates and may not generalize well to all cases. The discussion highlights the complexity of deriving a universally applicable equation for the problem.

pjhphysics
Messages
16
Reaction score
0
Hi,

Let's say I have two points:

Pa = (0, 0, -30)

Pb = (-2.5, -2.5, 7.5)

and I want to find the X and Y values for a third point on this line whose Z value is 30:

Pc = (X, Y, 30)

How can I achieve this? My math is not very great and I'm applying this to a computer program. So if possible, a straightforward, programmable format would be so great!
Thanks
 
Physics news on Phys.org
Anyone? please.
 
parametrize the line through P,Q by t, as all points of form P + t(Q-P).

then you get a linear formula for each of the three coordinates.

set the formula for Z equal to whatever and solve for t.

then plug back into the formulas to get the other two coords.

this is precalculus. so you can look it up anywhere.
 
Hey, thanks for your help.

What exactly is the form of this linear formula?
I'm not sure I understand how to set this up. Could you provide a demonstration please (or point me to one)?
Thanks so much.
 
Any line can be written x= At+ B, y= Ct+ D, z= Et+ F. Also you are free to choose t= 0 at anyone point on the line and t= 1 at any other point on the line. Knowing two points gives two equations for each pair of numbers, A and B, C and D, and E and F.

In your case, we can take t= 0 at Pa = (0, 0, -30) and have immediately x= A(0)+ B= 0 so B= 0, y= C(0)+ D= 0 so D= 0, and z= E(0)+ F= -30 so F= -30.

Now, take t= 1 at Pb = (-2.5, -2.5, 7.5) so x= A(1)+ 0= -2.5 which gives A= -2.5, y= C(1)+ 0= -2.5 so C= -2.5, and z= E(1)-30= 7.5 so E= 37.5.

You now have x= -2.5t, y= -2.5t, z= 37.5t- 30.

When z= 30, you have 37.5t- 30= 30. Solve that for t and use that t to find x and y.
 
in vector form, if P = (0, 0, -30)

and Q = (-2.5, -2.5, 7.5), then Q-P = (-2.5, -2.5, 37.5), so P + t(Q-P)

= (-2.5 t, -2.5 t, -30 + 37.5 t), thus if the last coordinate = 30, i.e. if you want

Z = -30 + 37.5 t = 30, then t = 60/37.5. then plug that back in the other two entries to get X and Y.
 
Last edited:
Hi,

I tried the same problem but slightly different way, without involving any equation but doing it geometrically.

Pa and Pb are the two points of a line in 3D, just project this line on -XZ (negative X and Positive Z) axis, the point Pa will have x intercept 0 and Z intercept -30, like way Pb will have -X = 2.5 and Z=7.5. Now this forms a triangle with angle Θ with the Z axis as shown in the picture.

tan Θ = 2.5/37.5 = x/60

x is the x intercept of the line at Z=30

solving this simple equation we can get x, in the same way we can proceed for y.

But this method works easy for this given problem, it might be tedious for higher complex problem...
 

Attachments

  • 1.jpg
    1.jpg
    6.1 KB · Views: 492
pjhphysics said:
Hi,

Let's say I have two points:

Pa = (0, 0, -30)

Pb = (-2.5, -2.5, 7.5)

and I want to find the X and Y values for a third point on this line whose Z value is 30:

Pc = (X, Y, 30)

How can I achieve this? My math is not very great and I'm applying this to a computer program. So if possible, a straightforward, programmable format would be so great!
Thanks

If all you want is a simple, programmable formula, do this: determine what percentage of the way between -30 and 7.5 30 is (it will, of course, be larger than 100%). The distance from -30 to 7.5 is 7.5-(-30)= 37.5. The distance from -30 to 30 is 30-(-30)= 60. So 30 is 60/37.5= 1.6 or 160% of the way from -30 to 7.5. Now, what x is 160% of the way from 0 to -2.5? 1.6(-2.5- 0)= -4. And, of course, the same calculation for y. The point (-4, -4, 30) lies on the line through (0, 0, -30) and (-2.5, -2.5, 7.5).
 
Hi,
Thanks for the help.
I derived the following, which seems to work in some but not all cases.
In cases where it doesn't work, it seems that the signs of Cx and Cy are the opposite of what they should be, which makes me think I need to put in an absolute value notation somewhere in my equation.

Please have a look:

Cx = (((Ax - Bx) * (Cz - Az)) / (Az - Bz)) + Ax
Cy = (((Ay - By) * (Cz - Az)) / (Az - Bz)) + Ay
 

Similar threads

  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
Replies
6
Views
8K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K