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

Username:   Password: 
 RegisterRegister   
 More on .RAW
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
RaPsCaLLioN




PostPosted: Thu Aug 26, 2004 6:57 pm   Post subject: (No subject)

a is the centroid (depth value) of each polygon which to sort by and b is the associated location of that polygon in the 'master' array.
Sponsor
Sponsor
Sponsor
sponsor
TheZsterBunny




PostPosted: Thu Aug 26, 2004 9:20 pm   Post subject: (No subject)

Cool. That helped very much.

Now, if you don't mind, another question.

How does one go about culling polygons? I think it may have to do with calculating the area of a polygon and seeing if it overlaps any polygons entirely, but I believe this would be less efficient than drawing every polygon.

-Z

p.s. got distance shading done!
Mazer




PostPosted: Fri Aug 27, 2004 5:56 am   Post subject: (No subject)

You could use the vertices of a triangle and get a normal vector for the face, then check the Z component of it to see if it goes into the screen or out of the screen. This would involve 'cross product', which you learn in grade 12 algebra, but I'm too lazy to explain it well enough right now. Check this site for more info.
RaPsCaLLioN




PostPosted: Fri Aug 27, 2004 9:33 am   Post subject: (No subject)

Yea like that. U should also use that method for shading.
TheZsterBunny




PostPosted: Fri Aug 27, 2004 5:54 pm   Post subject: (No subject)

...

This is the method I use for shading.

code:

        calclr := (abs (sort (1)) + sort (i)) / (abs (sort (1)) + sort (upper (shape)))
        if calclr > 1 then
            calclr := 1
        end if
        RGB.SetColor (clr, calclr, calclr, calclr)


where sort is my average Z array from lowest to highest.


--edit--

Mazer, I just finished struggling through grade 10 white math. It'll be a while before I learn this in class. If you get the time...

-Z
Mazer




PostPosted: Fri Aug 27, 2004 7:43 pm   Post subject: (No subject)

I thought the site in my link explained it pretty well, but ok. It's really easy, actually, and in my opinion Mr. Caldwell's method is much simpler. Thus, it's the method I'll use. Just give me a minute to make some pretty illustrations.
Mazer




PostPosted: Fri Aug 27, 2004 8:08 pm   Post subject: (No subject)

I hope this helps.

If you want to get the vectors from a triangle, pick an point and subtract it from the other two points. One more thing: order matters. If C = A crossed with B, then A crossed with b = -C.

Right hand rule:
Find vector A. Put your right hand out at A with your fingers stretched in the direction of the vector. Now curl your fingers toward vector B. Sticking your thumb out should show you the direction of vector C. I'm not sure how you would handle this. Are all of the triangles supposed to have their vertices listed in the same order?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 37 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: