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