Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 4643 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
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)
Then the line is defined as followed:

Now, you know y = 0 so
you can easily get t from this.
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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!