Sign in to follow this  
healeyx76

How would I draw a 3D Solid Plane? (in data)

Recommended Posts

Im looking for the most basic techniques to draw a plane. Say i have just a 3d array and I need a plane drawn in it. The only way I've thought of is to use Bresenham line drawing in 3d. I draw a "thickness" line, and then from each pixel on that line draw a perpindicular line and from each pixel on that line, draw yet another perpindicular line(to both previous). The problem with this is that it leaves gaps inside the plane sometimes. I figured I could just have it draw 4 pixels at once in an effort to get rid of gaps, but now I have the need to store the vectors of the plane and if I just do a 4 block, it messes it up. Any other ideas? Thanks a bunch.

Share this post


Link to post
Share on other sites
ax+by+cz+d==0;

Equation of a plane if I remember correctly.

Save a,b,c,d into a struct. Voila!

To actually draw it, do mathematical intersection with the cube that represents the maximal and minimal values of your x,y,z system. This should yield 4 lines, whose intersections form 4 vertices needed for a DX or OGL quad [rectangle].


Share this post


Link to post
Share on other sites
sorry, this is a discrete system that does not use graphics at all. By "draw" I would mean "change the pixel at [x][y][z] to a new value for all of the plane".

Its just a big 3D grid that I have to make planes in. Im using C, but any programming method will help, i just need a better way to do this, or an alternative that I can improve upon.

Share this post


Link to post
Share on other sites
Quote:
Original post by healeyx76
sorry, this is a discrete system that does not use graphics at all. By "draw" I would mean "change the pixel at [x][y][z] to a new value for all of the plane".


Actually, I found "draw" clearer than "change the pixel..." :) What I understand is than you are going to draw the plane in a 3D space (and not a projection of a 3D plane onto a 2D device). Just as if you had a real 3D screen. Am I right ? I will assume that I'm right :)

Bresenham will not allow you to correctly fill the whole surface. You'll probably have holes. Maybe some kind of 3D rasterisation method would work - I think it is the way to go : add one dimension to the classic polygon filler.

HTH

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this