Skip to main content
GameDev.net gamedev.net
🔒 Locked

Question about planes

Started by MegaBoomer Jul 29, 2006 at 2:27 AM 6 replies 950+ views
Original Post
MegaBoomer
MegaBoomer
How would I go about drawing a plane with a normal and a distance?
TimChan
TimChan
sorry but I afraid you can't draw a plane because it's area is infinite...
maybe you can draw a large rectangle instead.
MegaBoomer
MegaBoomer
ok how do i do that?
Enselic
Enselic
ax + by + cz + d = 0

gives

z = (-ax - by - d) / c

Pick 4 points in the x-y-plane and use the above equation to calculate the four corresponding z-values for the plane on that points, create a quad from those points and render and there you have part of a plane.

To render the normal just pick a point on the plane and draw a line from that point to a point on the line formed by that point and the normal vector.
haegarr
haegarr
Quote:
Original post by Enselic
ax + by + cz + d = 0

gives

z = (-ax - by - d) / c

Just for completion: Obviously there is a need of case distinction, since the 2nd formula doesn't work for planes where c is 0 or at least near to 0. You may use the maximum of the absolute |a|, |b|, and |c| to determine which case best to use, like so:

max(|a|,|b|,|c|) == |a| => x = (- by - cz - d) / a
max(|a|,|b|,|c|) == |b| => y = (- ax - cz - d) / b
max(|a|,|b|,|c|) == |c| => z = (- ax - by - d) / c

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.