Rotating hypercube6/12/2023 This image corresponds to the rotation sequence 0 30 60 0 i i, where i ranges from 0 to 360 by 2. Some of my outputs are mirror images of the question's examples.īonus animation I just made with this program. % so without a showpage, gs will immediately exit before you Showpage % gs's cmd-line-args option automatically sets -dBATCH, V exch get %lookup index in (sextuply-transformed) vertex arrayĬlosepath stroke %draw it, don't just think about it % on the stack is the Eulerian circuit array %Eulerian circuit (borrowed and adjusted for 0-based indexing) Also, perform the scale before translate, so translated coordinates can be 3 and 4 instead of 300 and 400. if du could be (T8)$, but if du is clearly a better choice (it's golf, not obfuscation per se). Also, translated a few operators from binary-token-strings back to abbreviated names where the BTS gave no savings, so (I)$ is now fora (ie. Instead, leave on stack and dup working copies as needed (once, at first, and again at the end of the loop). the faces) in a string.Įdit:-8 Remove definition of vertices array V. Re-apply dropped mo for mod and su for sub.Įdit:-12 In-line the project-and-draw function and remove (now empty) enclosing dictionary.Įdit:-36 Encoded the circuit (ie. And a space.Įdit:-16 Factor-out array brackets from unit vectors in the rotation matrices ( J K L and M). Defer execution of the code-description of the rotation matrix until its t value is ready.Įdit:-3 Remove $ ie. idiv) at the cost of a do-nothing 1 idiv.Įdit:-30 Applied implicit definition block from G.Įdit:-10 A few more triply-used sequences.Įdit:-45 Remove variables i j k l m n for the angles and always define the current angle as t and functions of angles use the value of the (global) t variable. aload) is shorter than Factored 3 calls to idi (ie. And applied binary-token-strings from the G library.Įdit:-49 Redefined sin cos and neg to shorter names.Įdit:-43 Defined short names for sequences 0 0 0 1 1 0.Įdit:-9 al (ie. Postscript 1075 732 683 640 631 601 590 545 542 526 514 478 470Įdit:-343 Applied binary-encoding generation of vectors and Eulerian circuit stolen borrowed from other answers. Open the images in a new tab, to see them in full size. Any default image output format is allowed. The output image should be at least 100 * 100 pixels, and the cube needs to take up at least 50% of the screen. The display can be a rasterized image, a vector image or an ASCII art. Your output should be a single image containing the hypercube. These represent the rotations in degrees on the different rotational planes of the hypercube. Your input is 6 integers between 0 (inclusively) and 360 (exclusively). You should use an orthogonal projection combined with a perspective projection to send (x, y, z, w) to (2x/(2+z), 2y/(2+z)). The following images show the structure of each matrix:Īfter all this, you have a rotated hypercube. After you have every matrix, you need to multiply the cube's vertices with them. To rotate this, you need 6 different matrices for each rotational plane, one for the YZ, XZ, XY, XW, YW and ZW planes. With all this information, you technically have a hypercube in code. The following list contains all of them (every group marks a quad): ABFE, CDHG, BCGF, DAEH, DCBA, FEHGĪBJI, DCKL, BCKJ, DAIL, FEMN, GHPO, FGON, EHPM, EAIM, BFNJ, CGOK, HDLP To create a hypercube, you need 16 4d vectors (a vector with an x, a y, a z and a w component). It's basically a cube, where each side is a cube. It's made by taking a cube net, extending it to the 3rd dimension, then – using the 4th dimension – folding it into a hypercube. A hypercube/tesseract is the 4 dimensional equivalent of a normal cube.
0 Comments
Leave a Reply. |