• ### Announcements

#### Archived

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

# Filling in the plane equation (Ax+By+Cz+D=0)

## Recommended Posts

How would I go about filling in the plane equation (Ax+By+Cz+D=0)? I am going to use it for collision detection, but I haven''t figured out how to fill in the equation as you can probably tell. Anyhow, please help me! If thispost = 0 Then GoBack() Else Read() End If

##### Share on other sites
Hi

the vector (A,B,C) is the ''normalized normal'' of the plane. D is the distance from the plane to the origin.
So the usual practice is to just hold the normal and D in a plane struct/class. Filling it in goes then like this:

  void Plane::FromPoints ( Vector v1, Vector v2, Vector v3 ){	Vector d1, d2;	d1 = v2 - v1;	d2 = v3 - v1;	normal = CrossProduct ( d2, d1 );	normal.Normalize ();	D = -(normal.x*v1.x + normal.y*v1.y + normal.z*v1.z);}

where v1, v2 and v3 are three arbitrary points on the plane

Runicsoft -- home of my open source Function Parser and more

##### Share on other sites
Don''t think it has to be normalized (A,B,C). You may want it normalized for other reasons though

##### Share on other sites
http://astronomy.swin.edu.au/~pbourke/geometry/planeeq/