PDA

View Full Version : triangle to plane


Remdul
03-13-2008, 07:27 AM
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...

Reedbeta
03-13-2008, 10:36 AM
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.

Remdul
03-13-2008, 04:03 PM
Good, I thought I was going crazy.

Many thanks once again. :)