• Advertisement
Sign in to follow this  

calculate x en z when y = 0 (line intersection)

This topic is 4375 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a line-segment in 3d space. pntA and pntB. I have a pntC somewhere on this line-segment where i know that the y of this pnt is 0. how would i calculate the x and z for pntC!? I know its easy :(

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
This is what I would do.
First I would search the direction vector assuming A(x1,y1,z1) and B(x2,y2,z2)
vec(x2-x1,y2-y1,z2-z1)
Then the line is defined as followed:
x=A.x+t*vec.x
y=A.y+t*vec.y
z=A.z+t*vec.z

Now, you know y = 0 so
0=A.y+t*vec.y
you can easily get t from this.
t=-A.y/vec.y
then when you get this value you can fill it in in the previous:
x= ...
z= ...

Not sure if it's correct but you can check it with some test values.

Share this post


Link to post
Share on other sites
You can just interpolate. Since its a line its linear with respect to its change along all axis. So if:
A = (-1,-1,-1)
B = (1,1,1)

And you are looking for the x and z values when y = 0

Since it is linear
x = 0
z = 0

This is as long as you have a line and not a curve, if you have a curve you will need an equation

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement