People always get the concept of rotation wrong ^^. The fact that a rotation is around an "axis" is only true for 3d, no other dimension has this link. You don't have the concept of a rotation axis in 2d without using the 3rd dimension as helper. Rotations actually happens in 2d rotation planes. The 2d space only has one plane, the 2d space itself. 3d has exactly 3 planes. A 2d plane in 3d has exactly one normal vector. However in 4d we have 6 rotation planes and each 2d plane has two normal vectors. It's basically just the number of combinations you can make from the component count. In 3d it's XY, XZ. YZ. In 4d it's XY, XZ, XW, YZ, YW, ZW. Any rotation in 3d is a "single" rotation. So even you rotate in several planes at the same time you always get a single rotation within a rotated plane (where the normal is the rotation axis). In 4d you can actually have double rotations that are independet from each other. Keep in mind a rotation matrix only changes the coorindates where the sin and cos are. Every "1" in a rotation matrix means that this dimension stays unchanged. In 4d you have two "1s". So a double rotation would be a combination where you exchange the two 1s with another rotation. So (XY and ZW) or (XZ and YW) or (XW and YZ). This gets more complex when dealing with 5d (10 rotation planes), 6d (15 rotation planes) or 7d (21 rotation planes). btw: Doing a double perspective projection and only from the center of an object is a rather arbitrary choice for projecting 4d into 2d. Keep in mind that you can also offset (move) 4d objects in 4 different directions. Usually in 3d we work with homogeneous coordinates to allow translation to be applied through a matrix. Though that means we actually use 4d vectors and 4x4 matrices for ordinary 3d. Lifting that up one dimension we actually need a 5x5 matrix and 5d vectors to do proper 4d stuff. This is important since the power of matrices lies in the fact that you can simply combine them into one. So you finally have a single matrix that does all sorts of local space rotation, position offsets, projecting down to 3d as a single matrix. Successive perspective projections can't be done as the perspective divide can't be performed in a matrix. It's done by the homogeneous divide at the end. 4d (or higher dimensions in general) is / are really fascinating. It gives you a new way of thinking of fundamental measures. "0d" you only have a single point with no size and no location since the whole space is just a single point. Therefore an "object" in 0d doesn't require any components in a vector to describe that object. "1d" space consists of infinitely points in a single direction. Now a new measure is born: length. The length between two points in 1d is the sum of infinitely many points between the start and end point. "2d" space consists of infinitely many "1d spaces" stacked next to each other. We get a second independent direction and a new measure: "area". A finite area is the sum of infinitely many 2d lines which each contains infinitely many points. So points squared (p^2) "3d" space consists of infinitely many "2d spaces" stacked next to each other. Again a new independent direction is used here. The new measure is "3d volume". A finite 3d volume contains infinitely many finite 2s spaces which contains infinitely many 1d spaces which contains infinitely many points (p^3) "4d" space consists of infinitely many 3d spaces stacked next to each other in a new independent direction. The new measure is "4d volume". A finite 4d volume contains infinitely many finite 3d volumes. (p^4) The 8 3d cubes which represent the boundary of the 4d volume are just the "surface" of the 4d volume. Inside a tesseract there is infinitely 3d volume, just like in a 3d solid cube there is infinitely many area if you could chop up the 3d volume into infinitely many slices. Note that the sum of 3d space inside a 4d volume is non overlapping. So inside a 1x1x1 4d cube there would be enough 3d space to hold our entire universe :P though, just statistically. We have a continous 3d space. The 3d space inside a 4d hypercube is folded in a weird way.
I really appreciate the amount of work put into this comment to convey such an amount of information in a comprehensive way that's not entirely mathematical yet enough to grasp the context and understand it. Bravo. Bravo.
The important thing to realize about rotations in n dimensions, is that the "basic" rotations *always* rotate within a plane. That is, there is a plane of rotation. There *is* still an "axis," but its dimension is n-2, so In two dimensions, n=2, the axis is a point. In n=3, the axis is a line. In n=4, the axis is a plane. Etc. In linear-algebra-speak, it is the invariant subspace of the rotation; the set of vectors that are invariant under the rotation. Fred
4:12 when he says that, i tried to look at the cube while forcing me to ignore this illusion of 3D to just see 2D lines and dots and then the tesseract totally makes sense ! Thank you for that Mr coding train
Yep, if you try hard enough the wireframe cube rotating looks like a small square distorting and then becoming the outer square, just like the tesseract with cubes!
Project a five-dimensional cube on a fourth-dimensional projection onto a three-dimensional construct onto a two-dimensional screen brought by a large amount of 0 dimensional pixels next :)
I mean if you really think about it the values of pixels are actually best represented as points in a three-dimensional colour space. Also if you want to add another layer to what you just said you should consider that the pixel data is actually stored in a one-dimensional array.
You are more of an inspiration than all programming movies combined. I'd say you did masters in mathematics and physics then ventured into programming coz that's prolly the only way to explain it.
As much as I love putting each class in separate files and testing each class using TDD and using the latest version of every package I'm using and making sure I refactor my code as I go, I see the benefit of doing things in this way to get results quicker. This kind of coding looks like great fun.
@@_gekyumeman4127 yeah, something like (1280x720) would be one dimensional. But I was referring to the pixels being actual physical objects that emit light which are in reality 3 dimensional, but we interpret them as 0 dimensional points.
Awesome video 👌 Laughed so much when you were like: "this code now really looks like it was written by a mad person... And it was" 🤣🤣 Gotta jump into the 4th dimension myself after work 😄
I just challenged myself to recreate this with a slightly different method (maybe in theory it's the same) but very happy with the result. Basically grabbed the idea of a source of light somewhere out in the fourth dimension, then interpolated from that point through every vertex of the hypercube and see where it lands in the w=0 dimension. Worked like a charm :D
Thanks for that wonderful train ride! To me, the next interesting thing to do is to make some other 4D shapes and subject them to these same 4D rotations. There are, e.g., 6 regular polytopes (hypersolids) in 4D, of which the tesseract is just one. Some important attributes of these, are the numbers of vertices, V, edges, E, faces, F, and cells, C (3D faces). I'll put these into a 4-list: (V, E, F, C). The simplest one (which is the 4D edition of a simplex), is the regular pentatope, or tetrahedral pyramid. It makes the least interesting model for this, but it's still worth portraying; it's analogous to the tetrahedron; its cells are tetrahedra. It has (V, E, F, C) = (5, 10, 10, 5). Then there's the hypercube; tesseract; analogous to the cube; its cells are cubes. (V, E, F, C) = (16, 32, 24, 8) Next is the "dual" of the hypercube, the cross-polytope; 16-cell; analogous to the octahedron; its cells are tetrahedra. (V, E, F, C) = (8, 24, 32, 16) Then perhaps the most interesting, the "hyperdiamond;" 24-cell; not analogous to anything else in any number of dimensions; its cells are octahedra. (V, E, F, C) = (24, 96, 96, 24) The last two are really complex & cluttered, but fascinating nonetheless: The 120-cell; analogous to the dodecahedron; its cells are dodecahedra. (V, E, F, C) = (600, 1200, 720, 120) The 600-cell; analogous to the icosahedron; its cells are tetrahedra. (V, E, F, C) = (120, 720, 1200, 600) And there are plenty of other interesting polytopes; in 4D you can "cross" one polygon with another; e.g., square x square = hypercube. What this operation amounts to is, at every point (both boundary & interior!) of polygon #1 in xy-space, you erect polygon #2 in zw-space. The result has somewhat of a "hypertorus" feel to it. Fred
From your examples, it looks like the Euler formula generalizes from V - E + F = 2, to V - E + F - C = 0 in 4D. I could not immediately establish whether this is true or why it might be, so I googled a bit and came upon this: www.ems-ph.org/journals/show_pdf.php?issn=0013-6018&vol=62&iss=4&rank=6 (it will return you a PDF file, so if that terrifies you, don't click the link)
Coding Challenge #5470 The black hole to the 34th dimension can now be opened via Javascript. The Coding Train has taken over all worldly systems, rendering him a god. The hyperspace travel's gotta be refactored later tho
Seeing this years late. Anyway what helped me understand how a tesseract is a projection of 4D space into 3D space, is to stare at your projection of a 3D cube into 2D space (the screen), and watch the points and planes change shape as it rotates. Watch how the trapezoid that represents one of the sides flattens as we start to view it "edge on", and watch how they intersect each other in 2D space. We know that intersection is an artifact of the projection into a lower dimension, just like the mind-bending intersections of a tesseract are an artifact of its projection into 3D (or really into a 2D representation of 3D). Try to break the illusion of it being 3D and see how the projection itself changes shape. Once I started to see it that way, looking at a projection of a 4D shape I better understood it as a projection, and stopped trying to see it in 3D.
Ahora ya entiendo por que es un tren, por que nos das el pasaje. esta vez a la cuarta dimension projectada en 3D, gracias por tanto. Saludos desde Bolivia
What if gravity is actualy 4th dimension? Or consequence of 4D because it is pushing space similar to X and W rotation? Also kind of proves we could create wormhole?
How to make the beginning code at the start of the video because when I click the link that says code it says that the coding train has been recently renovated
When you render 3D objects on 2D screen you have to, well, fit in 2D space so it gets chopped down, with 4D figures it gets cut even further. I wonder how would 4d objects look like in 3d space from for example laser visualisation, would this make rotating on W axis more clear?
Hello! I'm a follower of your courses and if may I suggest, it will be good for us have the "starter sketches" to train with you. Anyways, thanks for your lessons!
I want to make a program that will accept length, width and height from user at run time. Based on the user input a 3d box will be created. Can I achieve this using Java Applet or Swing? if not then what programming language and tools I need to use?
Apologies! I'm working on updating the new website! You can file an issue here to request it: github.com/CodingTrain/thecodingtrain.com/issues For now you can find the code here: github.com/CodingTrain/Coding-Challenges/tree/main/113_Hypercube
I think if you put into high dimension (let's say 30-Dimensions) -- it will end up like a worm eating on the 'front' end and wasting on the 'back' end. Maybe one big fat rounded worm and not the long worm. I could be wrong with my imagination.
At the end, when it is rotating, its almost like its a cube rotating on itself or something. If you watch, the points will move away, but always come back to form a cube in the center, only to repeat. I love 4D stuff.
Professor, every time I code in P5JS I get these alerts in my console: "Use of the orientation sensor is deprecated. p5.min.js:7:28205 Use of the motion sensor is deprecated." I wonder if it is something I should worry about,
Dunno exactly but I had some sort of this in Java with date and kalendar which turned out to be that the calendar basically should replace date... So I think there could be some new classes that have the same purpose and the developers want you to use them