Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   AVS (http://forums.winamp.com/forumdisplay.php?f=85)
-   -   Polehedra... (http://forums.winamp.com/showthread.php?t=232444)

JFASI 3rd December 2005 16:27

Polehedra...
 
I'm trying to find an algorithm to model three dimensional regular to semiregular polyhedra using the Wythoff symbol . I've seen it done manually on Mathematica, but I use Maple and, well, Mathematica pales in comparison...

QuadHeliX 4th December 2005 07:25

cant wait to see it!

JFASI 4th December 2005 16:24

I'm trying to find out what Maple does to do it, but that's kind of a stretch. I't going to be tough to actually fill the the faces and all...

jheriko 9th December 2005 06:01

filling faces is easy with triangle ape. for the trivial (triangle fan) way to draw any polygon just use two adjacent vertices for two of the triangle vertices, and the centre point of the polygon for the third (average of all vertices). breaks on concave polys tho... since there is no way to reverse get them from points...

JFASI 9th December 2005 18:43

I must admit, I never did triangle APE before...

I need a rundown, it sounds like a possibility.

UIUC85 9th December 2005 20:37

It's more or less like superscope, but instead of having just one point, you assign 3. So in a ssc we have (x,y) to define but with the triangle ape we have (x1,y1) (x2,y2) (x3,y3). If you can do a ssc, this isn't much different.

StevenRoy 9th December 2005 20:45

It's not that different from Superscope; you mainly just set x1, y1, x2, y2, x3, and y3, instead of just the one point (x and y) with the Superscope.

Also, to change the color, set "red1", "green1", and "blue1", instead of just "red", "green" and "blue". I think it's this way because there might (fat chance) be a later version which will let you use different colours for each point, and it will shade. (This would be cool, but probably too slow to be practical.)

There is also a "zbuf" variable you can set to 1 to enable a simple form of Z-buffering. With this enabled, you can set the z1 variable to the distance to control the "Z-order" of the triangles. This is often quicker and easier than doing full depth-sorting for 3d scenes.

Am I forgetting anything?

PAK-9 9th December 2005 21:10

/Points to the guide

JFASI 10th December 2005 13:17

Ok, does it draw just a triangle or fill it in?

Grandchild 10th December 2005 16:47

it fills it in, that's the thrill to it!

JFASI 10th December 2005 21:10

Tres nice.

What about 3D? Or is Z-Buffering 3D...Bear with me...





Hahaha...trivial (triangle fan)...Get it? tri Hahahaha! That's so funny! Hahahaha!

jheriko 11th December 2005 13:15

There is a more efficient, and less trivial way. Which is to make a triangle fan from one vertex... it reduces the number of triangles by 1, but its not as easy to see how to implement, and looks ugly when subdivided/tesselated.

You can use 'z' to implement a flat z-buffer. i.e. one z value gets drawn per triangle.

JFASI 11th December 2005 13:43

So it'd be tricky for polyhedra...

jheriko 11th December 2005 13:53

not really. its long winded to write, but you can prove that for any convex solid, back face culling is enough to correctly occlude the faces. its basically common sense, imagine holding out a polyhedron. the only faces you can see are the ones pointing within 90 degrees the opposite of your view direction, the ones you cant see are all facing away in the remaining 180 degrees.

you can do this test with a dot product and checking its sign... its in lots of presets, look at 'starfighter redux' in wfc2 i would recommend 'jet wash', but the code is in huge avstrans-ed blocks. in fact any of the model presets i have ever made probably contain it.

you need to introduce 'occlusion' before z buffer is really necessary. e.g. convex objects that can have two triangles overlapping in 2d projection, both facing the viewer. or multiple objects, where one passes infront of the other.

JFASI 11th December 2005 17:21

Ok, that's an idea, but still, I need to figure out how to get the Wythoff symbol or even the Schalffi symbol to yeild a polyhedron. Tough stuff...

StevenRoy 11th December 2005 22:19

Yeah, all this is well and good, but how do we figure out where to put the freakin' points in the first place!?

JFASI 11th December 2005 23:07

Exactly. I'm still thinking...

jheriko 11th December 2005 23:36

Forget those symbols and things... too elaborate.

Here are a couple of simple examples using a dodecahedron... I will add a couple more tomorrow, but I am tired right now.

ftp://jheriko.kicks-ass.net:69/AVS/Jheriko/examples/

The platonic solids are all pretty easy to construct, and using some more geometry you can truncate them and stellate them into lots of other stuff. Also there are some other special cases that are interesting... check out these old packs of mine, feel free to steal the vertices:

http://www.deviantart.com/deviation/720677/
http://www.deviantart.com/deviation/743266/
http://www.deviantart.com/deviation/911279/

JFASI 12th December 2005 20:09

Cool thanks. There is a bit of fun math that turns symbols into polydehra, but I don't quite get it...
I'm a junior in high school, you see...

jheriko 13th December 2005 00:00

well.. the way the symbol works is by defining vertices on the inside of a sphere. but its not particularly useful unless you have a method of finding a convex hull... etc... its long winded. easier to work out a specific polyhedron that you want, and use it...

JFASI 13th December 2005 01:18

Well, I cound use the brute ofrce method, where it just screws around for a while, but that would be no good for a visualization. Besides, for simple coding, AVS syntax is just ugly.

jheriko 13th December 2005 23:02

You only need to generate a polyhedron once. Brute force it and stick it in the megabuf. Why make it so hard tho? Every specific polyhedron has a simple construction method.

jheriko 14th December 2005 02:49

not quite perfect, but i did the dm example. i can't be bothered to fix it right now... i can't work out why its broken... probably from looking at it for too long:

ftp://jheriko.kicks-ass.net:69/AVS/J...%20DM%203D.avs

it gets the k correctly, but the texturing is messed up, and i had to make the camera face backwards in the dm for some reason... i will work it out later...


All times are GMT. The time now is 22:16.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.