Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


How to I find y given x,z inside a plane

This topic is 5322 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

Hi, I have a triangle ABC given by 3 points, x1,y1,z1; x2,y2,z2; and x3,y3,z3 I have a point inside triangle ABC, given x,z how do I find y? Thanks in advance!

Share this post

Link to post
Share on other sites
The plane equation...

d = a*x + b*y + c+z

Where (x,y,z) is any point on the plane, (a,b,c) is the unit normal of the plane and d is the distance (0,0,0) is from the plane. If (a,b,c) is not a unit vector then d is the distance (0,0,0) is from the plane mutiplied by |(a,b,c)|.

The normal vector can be calculated like this:

(a,b,c) = (p2-p1) cross (p3-p1)

Where p1, p2, and p3 are points on the plane (your triangle). From here you can normalize (a,b,c) if you want but it's not necessary.

The plane constant, d, can be calculated like this:

d = (a,b,c) dot p1
d = a*p1.x + b*p1.y + c*p1.z

Now you know d and (a,b,c) and you have an x and z value so just use the plane equation to solve for y. Like this:

d = a*x + b*y + c*z
b*y = d - a*x - c*z
y = (d - a*x - c*z) / b

[edited by - nonoptimalrobot on February 28, 2004 5:21:13 PM]

Share this post

Link to post
Share on other sites

  • 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!