Jump to content
  • Advertisement

Archived

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

AndreTheGiant

Distane of point to plane

This topic is 5420 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 want to find the distance from a plane to an arbitrary point. Ive googled this and found hundreds of pages of answers, but all of them were for the ax + by + cz + d = 0 form of a plane. I use the point-normal form of planes. So how can I do it?

Share this post


Link to post
Share on other sites
Advertisement
I might be a little off,

but if 'n' is your normal -> (n1, n2, n3)

then Cartesion form of your plane would be
(of the form Ax + By + Cz + D = 0 ):

n1*x + n2*y + n3*z - D = 0


from that you should be able to calculate your distance from an arbitrary point to your plane.

( i think )


please, anyone feel free to correct me. heh



[edited by - _vizual_ on January 14, 2004 1:16:13 AM]

Share this post


Link to post
Share on other sites
not quite viz
Distance=dot(Point,Plane.Normal)-dot(Plane.Normal,Plane.Point)

but really rather then storing a point on the plane you should store precomputed "dot(Plane.Normal,Plane.Point)" sence thats alot of extra to do, and thats what people normaly do and if you need better way to think of it, it''s the distance from the origin to the plane

Share this post


Link to post
Share on other sites
Just use Hessian normal form of a plane

distance = dot([unit normal],x0) + p.

x0 is your arbitrary point (x,y,z)

(look up Hessian form and you'll see 'p')

badda badda schwing!

JHL,

I fail to see where the method I stated was incorrect. It's one way of doing it. Ofcourse there is much more involved after that as well. I don't recall your forumlae but it certainly looks more elegant if thats is all.

[edited by - _vizual_ on January 14, 2004 2:25:06 AM]

Share this post


Link to post
Share on other sites
>Distance=dot(Point,Plane.Normal)-dot(Plane.Normal,Plane.Point)

id prefer dot(Plane.Normal, Point-Plane.Point) though ,-)

Share this post


Link to post
Share on other sites
To find the distance a point is from a plane:

distance = AX + BY + CZ + D

Where ABC is the normal of the plane, XYZ is the point you're testing, and D is the plane-shift distance from the origin. This can also be expressed as:

distance = N.P + D

If the distance is 0 then the point lies on the plane, if the distance is greater than 0 then the point lies on the front side of the plane (the front of a plane is defined by its normal's direction), and finally, if the distance is less then 0 then the point lies on the back side of the plane.

EDIT: Trienco, thanks for pointing that out.

[edited by - Chacha on January 16, 2004 6:30:52 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Chacha
To find the distance a point is from a plane:

distance = AX + BY + CZ + D

Where ABC is the normal of the plane, XYZ defines any point located on the plane, and D is the plane-shift distance from the origin.



call me blind, but to find the distance between a point and a plane, shouldnt the point show up somewhere in the equation?

also, calculating D would probably be done as XYZ.N, while in the function above xyz should rather be point itself. so we end up with N.P - N.V (V being a point on the plane) which should be slightly less work as N.(P-V). basically you just get a vector from anywhere on the plane and project it on the planes normal (which will mean how many times the normal vector is the point from the plane.. as the normal is unit length its also the distance)

[edited by - Trienco on January 15, 2004 3:49:04 AM]

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!