Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3D Surface

Status
Not open for further replies.

wraygun

Programmer
Dec 9, 2001
272
US
Okay, I have a 3D Cube, using the following points:

x1,y1,z1
x2,y2,z2
x3,y3,z3
x4,y4,z4
x5,y5,z5
x6,y6,z6
x7,y7,z7
x8,y8,z8

I've figured out 3D rotation, but I'm having trouble figuring out a good equation for drawing a solid surface. Any help would be greatly appreciated.

Thanks,
The Gun
My question is
 
I'm pretty sure I do not understand the question,. It 'looks like' all you are asking is how to fill the various rectangles. If that's all there is ... (Peggy Lee?)

There are several approaches. Two which come to mind: Polygon fill (API call). Map the 3D coordinates to the 2D perspective and "draw" the lines within the area. MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Hi Michael,

What I'm writing is Unfolding Software for SheetMetal, more specifically, Ductwork.

So far, I've successfully mapped the 3d image in 2d on the screen. I can rotate, blah, blah, blah, but, I would like to shade the sides, and perhaps hide the 'out of sight' lines so that it adds a degree of realism. I'm not particular as to what I use to obtain my goals. Currently I'm using the line command to draw the piece. If there's a better option, I'm certainly open to it. If there's a formula or sequence of formulas that I could use, that would probably be ideal. But any info is going to be helpful. Thank you for your reply.

The Gun
 
I do not remember the name of the function. It is an API something like PolyFill (polygon fill). It is (from VB) the only way to directly fill an irregular shape, and (I THINK) it requires a CLOSED polygon. If you can find the actual API call, it includes the parameters, so it becomes just a matter of making sure you have drawn the shapes as closed polygons and selecting them and their 'fill' color / pattern.

The other approach (in VB) is to just draw 'lines' close enough together to appear to be a fill. This is one of hte techniques used in VB to obtain the gradient look (shade between to colors). The big downside to this is simply that you need to do all of the math to determine the endpoints of the lines. It is not all that hard, and there are several approaches, but it can be a bit tricky if you aren't familiar with the graphics conventions and syntax.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top