Computer Science Canada

3-D triangle

Author:  TheFerret [ Thu May 06, 2004 9:06 am ]
Post subject:  3-D triangle

I have a 3-D triangle program that I have made and am wondering if it is possible to colour all the faces a different colour than the other...

Author:  Homer_simpson [ Thu May 06, 2004 9:24 am ]
Post subject: 

you'll have to use a shading method and follow certain algorithms...

Author:  TheFerret [ Thu May 06, 2004 6:13 pm ]
Post subject: 

would you like to show an expample of is it too complicated...

Author:  guruguru [ Fri May 07, 2004 9:39 pm ]
Post subject: 

A quick way to do it but it doesnt work with overlapping (you figure that out 8) ) is as follows for one face. You track three point throughout the whole program. These points must form a 2D triangle on one side. You then draw a polygon (check reference) and fill it a certain color. You use this tecqnique for the rest of the sides, but the overlapping gets tricky and im not going to get into that here.

This is a quick example that makes one side blue. Put the vars at the top and the other stuff where you draw the lines.

code:

var face1X, face1Y : array 1 .. 3 of int

face1X(1) := x
face1X(2) := c
face1X(3) := z

face1Y(1) := a
face1Y(2) := b
face1Y(3) := e   
   
Draw.FillPolygon (face1X, face1Y, 3, blue)

Author:  TheFerret [ Sat May 08, 2004 2:05 am ]
Post subject: 

I get what you mean and got it to work better (not perfect), I have all 4 polygons for the right var but when you run only 3 show up (but if you comment them out except one(different one each time) they show up)...

P.S. I am so tired, it is 3:05 AM here and I am working on a Turing program, GEEZ... Shocked Twisted Evil Surprised Wink

Author:  guruguru [ Sun May 09, 2004 4:38 pm ]
Post subject: 

THis is where it gets difficult. Everytime the triangle rotates, a new side will be in front. But when you draw the faces, you are always drawing the faces in the same order with the same one in front. You have to keep track of which face is in front, second etc... Possible giving them z values might work. There are probally examples either int his forum, submissions forum, or in the tutorials. Take a quick look and good luck!

Author:  Homer_simpson [ Mon May 10, 2004 10:48 pm ]
Post subject: 

fuck that...
read this:
http://www.whisqu.se/per/docs/graphics8.htm
http://www.whisqu.se/per/docs/graphics6.htm
http://www.whisqu.se/per/docs/graphics7.htm
http://www.whisqu.se/per/docs/graphics9.htm

Author:  TheFerret [ Tue May 11, 2004 3:15 pm ]
Post subject: 

Now this is hard to do...

Author:  Homer_simpson [ Thu May 13, 2004 3:16 pm ]
Post subject: 

but it's the actual way to do it... but dont even bother doing it in turing it's useless...

Author:  TheFerret [ Thu May 13, 2004 5:06 pm ]
Post subject: 

I found a way to shade but it draws it dot by dot and is slow...


: