Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 3-D triangle
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheFerret




PostPosted: 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...


3dtri.t
 Description:

Download
 Filename:  3dtri.t
 Filesize:  1.83 KB
 Downloaded:  231 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Thu May 06, 2004 9:24 am   Post subject: (No subject)

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




PostPosted: Thu May 06, 2004 6:13 pm   Post subject: (No subject)

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




PostPosted: Fri May 07, 2004 9:39 pm   Post subject: (No 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)
TheFerret




PostPosted: Sat May 08, 2004 2:05 am   Post subject: (No 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



3dtri.t
 Description:
ZZZZZZZZZZZZZZZZZZZZZ....

Download
 Filename:  3dtri.t
 Filesize:  2.81 KB
 Downloaded:  236 Time(s)

guruguru




PostPosted: Sun May 09, 2004 4:38 pm   Post subject: (No 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!
Homer_simpson




PostPosted: Mon May 10, 2004 10:48 pm   Post subject: (No 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
TheFerret




PostPosted: Tue May 11, 2004 3:15 pm   Post subject: (No subject)

Now this is hard to do...
Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Thu May 13, 2004 3:16 pm   Post subject: (No subject)

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




PostPosted: Thu May 13, 2004 5:06 pm   Post subject: (No subject)

I found a way to shade but it draws it dot by dot and is slow...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: