3 ms·
Wow, cool to see this here. I've been working on reproducing some of it in numpy/matplotlib for the past 2 weeks! I liked their 3D-sliced 120-cell (equivalent
by chubot 8y ago
Wow, cool to see this here. I've been working on reproducing some of it in numpy/matplotlib for the past 2 weeks! I liked their 3D-sliced 120-cell (equivalent of the dodecahedron), and it wasn't too difficult to reproduce.
Step 1: Use Schlafli generator from here [1]. Schlafli numbers are a compact description of regular polytopes, and there is a recursive algorithm to generate vertices, edges, faces, etc. from them. The base case of the recursion is dimension 1, so you make 4 calls to get to dimension 4.
Step 2: Intersect the edges of the polytope with a hyperplane (a 3D subset of 4D).
Step 3: You get a set of 3D points out of step 2. Draw the convex hull of them, which gives you triangles.
Step 4: Render the triangles somehow. I used matplotlib's 3d facilities (mplot3d), and we are working on raytracing them.
Step 5: Animate over different hyperplanes. Take the min and max in the w plane and that will give you non-empty slices. Now you can "see" the 4D polytope using time as the 4th dimension.
I sure he is doing something more advanced (4D collision detection), but this is all we needed to reproduce something that looks kinda cool.
[1] https://github.com/aruth2/schlafli https://github.com/aruth2/schlafli