# triangle to plane

2 replies to this topic

### #1Remdul

New Member

• Members
• 29 posts

Posted 13 March 2008 - 02:27 PM

I want to compute a plane (x,y,z = normal, w = distance to origin) from a 3d triangle (v1,v2,v3), so the three verts will lie on the plane. I already have the triangle normal and all that.

I've coded working functions dozens of times before but I can't possibly understand how to replicate this again. All I end up with is a single Dot Product, my brain thinks a sqrt() is needed somewhere to compute the plane w element. I'm confused...

### #2Reedbeta

DevMaster Staff

• 5340 posts
• LocationSanta Clara, CA

Posted 13 March 2008 - 05:36 PM

It really is just a single dot product. The plane equation is N · X = N · P where P is a point on the plane (i.e. one of the triangle vertices), so if you want to recast this in the form N · X + w = 0, you just calculate w = -N · P.

You don't need any sqrt() unless you want to normalize the plane normal.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #3Remdul

New Member

• Members
• 29 posts

Posted 13 March 2008 - 11:03 PM

Good, I thought I was going crazy.

Many thanks once again. :)

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users