title

Coding Challenge #113: 4D Hypercube (aka "Tesseract")

description

In this coding challenge, I visualize a 4D Hypercube (aka "Tesseract") in Processing (Java). Code: https://thecodingtrain.com/challenges/113-4d-hypercube-aka-tesseract
đšī¸ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/n0y8ntgWi
đĨ Previous video: https://youtu.be/p4Iz0XJY-Qk?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
đĨ Next video: https://youtu.be/67k3I2GxTH8?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
đĨ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
References:
đĸ Matrix Multiplication: http://matrixmultiplication.xyz
đ Rotation Matrix on Wikipedia: https://en.wikipedia.org/wiki/Rotation_matrix
đ 3D Projection on Wikipedia: https://en.wikipedia.org/wiki/3D_projection
đ Tesseract on Wikipedia: https://en.wikipedia.org/wiki/Tesseract
Videos:
đĨ Understanding 4D -- The Tesseract: https://youtu.be/iGO12Z5Lw8s
đ 3D Rendering with Rotation and Projection: https://youtu.be/p4Iz0XJY-Qk
đ Matrix Math: https://youtu.be/uSzGdfdOoG8
đ Matrix Multiplication for 3D Rendering: https://youtu.be/tzsgS19RRc8
đ´ Coding Train Live 148.2: https://youtu.be/M_YNwb7UudI?t=1370s
Related Coding Challenges:
đ #112 3D Rendering with Rotation and Projection: https://youtu.be/p4Iz0XJY-Qk
Timestamps:
0:00 Introducing today's topic: rendering a 4D hypercube
7:30 Create a P4Vector class
9:43 Extend the points array to have 16 points
13:06 Create the projection matrix
16:16 Stereographic projection
18:04 Connect the points
22:17 Add an offset to the connect function
26:26 Create rotation in the 4th dimension
29:49 Create a rotationXY matrix
36:52 Rotate around the w axis
40:23 We have now entered the 4th dimension!!
40:58 What dimension could you visualize?
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
đ Website: http://thecodingtrain.com/
đž Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
đŠ Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
đĄ GitHub: https://github.com/CodingTrain
đŦ Discord: https://thecodingtrain.com/discord
đ Membership: http://youtube.com/thecodingtrain/join
đ Store: https://standard.tv/codingtrain
đī¸ Twitter: https://twitter.com/thecodingtrain
đ¸ Instagram: https://www.instagram.com/the.coding.train/
đĨ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
đĨ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
đ p5.js: https://p5js.org
đ p5.js Web Editor: https://editor.p5js.org/
đ Processing: https://processing.org
đ Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#3drendering #orthographicprojection #rotationmatrix #4dhypercube #tesseract #processing

detail

{'title': 'Coding Challenge #113: 4D Hypercube (aka "Tesseract")', 'heatmap': [{'end': 794.705, 'start': 763.194, 'weight': 1}], 'summary': 'Explores a coding challenge transitioning to the fourth dimension, visualizing higher dimensions with matrices and projecting 4d points into 3d, discussing challenges and implementing 3d rotations in code with an emphasis on visualizing the tesseract.', 'chapters': [{'end': 50.946, 'segs': [{'end': 30.234, 'src': 'embed', 'start': 2.827, 'weight': 0, 'content': [{'end': 13.408, 'text': 'Welcome to a coding challenge where I will enter the fourth dimension.', 'start': 2.827, 'duration': 10.581}, {'end': 21.407, 'text': "Well, I didn't really time, I expected some dramatic moment to happen with the music there, which didn't happen, but all right.", 'start': 16.584, 'duration': 4.823}, {'end': 22.868, 'text': 'So this is a coding challenge.', 'start': 21.567, 'duration': 1.301}, {'end': 26.351, 'text': "I'm so crazily excited about this.", 'start': 22.948, 'duration': 3.403}, {'end': 30.234, 'text': "If this actually works, I think that, I don't know what's gonna happen.", 'start': 26.671, 'duration': 3.563}], 'summary': 'Coding challenge in the fourth dimension with high excitement.', 'duration': 27.407, 'max_score': 2.827, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo2827.jpg'}], 'start': 2.827, 'title': 'A coding challenge: fourth dimension', 'summary': 'Explores a coding challenge involving a spinning cube and the potential transition to the fourth dimension, expressing excitement and anticipation for the outcome.', 'chapters': [{'end': 50.946, 'start': 2.827, 'title': 'Coding challenge: fourth dimension', 'summary': 'Explores a coding challenge involving a spinning cube and the potential transition to the fourth dimension, expressing excitement and anticipation for the outcome.', 'duration': 48.119, 'highlights': ['The presenter expresses excitement and anticipation for the outcome of the coding challenge, using vivid imagery to convey the potential impact on the audience.', 'The coding challenge involves working with a spinning cube in three dimensions, with the aspiration to transition to the fourth dimension.']}], 'duration': 48.119, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo2827.jpg', 'highlights': ['The coding challenge involves working with a spinning cube in three dimensions, with the aspiration to transition to the fourth dimension.', 'The presenter expresses excitement and anticipation for the outcome of the coding challenge, using vivid imagery to convey the potential impact on the audience.']}, {'end': 377.878, 'segs': [{'end': 132.924, 'src': 'embed', 'start': 51.426, 'weight': 2, 'content': [{'end': 63.032, 'text': 'I want to make a hypercube spinning in the fourth dimension.', 'start': 51.426, 'duration': 11.606}, {'end': 69.036, 'text': 'So I want to make something that looks like this.', 'start': 64.333, 'duration': 4.703}, {'end': 74.958, 'text': 'All right, so this is a hypercube, otherwise known as a tesseract.', 'start': 69.056, 'duration': 5.902}, {'end': 80.119, 'text': "And before I start coding any of this, I'm going to explain to you what that is exactly.", 'start': 76.238, 'duration': 3.881}, {'end': 81.619, 'text': 'So let me come over here.', 'start': 80.539, 'duration': 1.08}, {'end': 87.661, 'text': 'So I think my favorite dimension is one dimension.', 'start': 81.659, 'duration': 6.002}, {'end': 88.561, 'text': 'Oh, no, zero.', 'start': 87.801, 'duration': 0.76}, {'end': 90.322, 'text': "Let's start with zero dimensions.", 'start': 88.601, 'duration': 1.721}, {'end': 91.302, 'text': 'A point.', 'start': 90.862, 'duration': 0.44}, {'end': 98.082, 'text': 'is a shape that exists in zero d.', 'start': 92.379, 'duration': 5.703}, {'end': 98.702, 'text': "That's a zero.", 'start': 98.082, 'duration': 0.62}, {'end': 107.027, 'text': 'Now, a line, which is bound by two points, is something that exists in one-dimensional space.', 'start': 98.782, 'duration': 8.245}, {'end': 108.627, 'text': 'This is one-dimensional space.', 'start': 107.067, 'duration': 1.56}, {'end': 120.333, 'text': 'A rectangle, a square, a plane, which is bound by one, two, three, four lines, exists in two-dimensional space.', 'start': 110.989, 'duration': 9.344}, {'end': 121.454, 'text': 'Now, notice a pattern here.', 'start': 120.353, 'duration': 1.101}, {'end': 132.924, 'text': 'This is bound by two points, this is bound by four lines.', 'start': 123.281, 'duration': 9.643}], 'summary': 'Creating a hypercube in the fourth dimension using coding and explaining dimensions visually.', 'duration': 81.498, 'max_score': 51.426, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo51426.jpg'}, {'end': 332.45, 'src': 'embed', 'start': 306.554, 'weight': 0, 'content': [{'end': 312.345, 'text': "And if this is true, There's no reason why I couldn't create a 5D shape and a 6D shape and a 7D shape.", 'start': 306.554, 'duration': 5.791}, {'end': 316.566, 'text': 'And I project 7D into 6D into 5D into 4D and then into 3D and visualize it.', 'start': 312.525, 'duration': 4.041}, {'end': 319.727, 'text': "So this is what I'm going to attempt to do in this video.", 'start': 316.886, 'duration': 2.841}, {'end': 323.608, 'text': 'It is going to require matrices.', 'start': 320.107, 'duration': 3.501}, {'end': 329.569, 'text': "There are ways to do it without it or to create the visual illusion of it, but I'm going to be using matrices.", 'start': 324.928, 'duration': 4.641}, {'end': 332.45, 'text': 'And the matrices are going to be used for a couple of things.', 'start': 329.99, 'duration': 2.46}], 'summary': 'Attempting to create 5d, 6d, and 7d shapes using matrices for visualization.', 'duration': 25.896, 'max_score': 306.554, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo306554.jpg'}], 'start': 51.426, 'title': 'Visualizing higher dimensions with matrices', 'summary': 'Discusses visualizing higher dimensions, progresses to four dimensions, and explains projecting and visualizing higher-dimensional shapes on a 2d computer screen using matrices and rotation, with potential to create 4d, 5d, 6d, and 7d shapes in the p3d renderer.', 'chapters': [{'end': 221.181, 'start': 51.426, 'title': 'Visualizing higher dimensions', 'summary': 'Discusses visualizing higher dimensions, starting from zero dimensions and progressing to four dimensions, with the assertion that human beings cannot naturally comprehend dimensions higher than three.', 'duration': 169.755, 'highlights': ['The concept of dimensions is explained, starting from zero dimensions to four dimensions, with examples of shapes existing in each dimension, such as points, lines, rectangles, and cubes.', 'A hypercube, also known as a tesseract, is described as existing in four dimensions and being bound by eight cubes, with the acknowledgment that human beings struggle to visualize dimensions higher than three.', 'The speaker expresses the difficulty of visualizing dimensions higher than three, stating that human beings did not evolve to understand dimensions beyond three.', 'The speaker humorously acknowledges the challenge of visualizing higher dimensions, inviting the audience to join in the struggle.']}, {'end': 377.878, 'start': 222.389, 'title': 'Visualizing higher dimensions with matrices', 'summary': 'Explains the process of projecting and visualizing higher-dimensional shapes on a 2d computer screen using matrices and rotation, with the potential to create 4d, 5d, 6d, and 7d shapes in the p3d renderer, requiring matrices for projection and rotation.', 'duration': 155.489, 'highlights': ['The process of projecting and visualizing higher-dimensional shapes on a 2D computer screen using matrices and rotation. The chapter discusses the process of projecting higher-dimensional shapes onto a 2D screen using matrices and rotation, enabling visualization of 3D shapes on a 2D computer screen.', 'The potential to create 4D, 5D, 6D, and 7D shapes in the P3D renderer, requiring matrices for projection and rotation. The potential to create 4D, 5D, 6D, and 7D shapes and visualize them in the P3D renderer using matrices for projection and rotation.', 'Requirement of matrices for projection and rotation, with the use of a projection matrix for turning a 4D point into a 3D point and a rotation matrix for rotating around different axes. The need for matrices for projection and rotation, including the use of a projection matrix to transform a 4D point into a 3D point and a rotation matrix for rotating around diverse axes.']}], 'duration': 326.452, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo51426.jpg', 'highlights': ['The potential to create 4D, 5D, 6D, and 7D shapes in the P3D renderer, requiring matrices for projection and rotation.', 'The process of projecting and visualizing higher-dimensional shapes on a 2D computer screen using matrices and rotation.', 'A hypercube, also known as a tesseract, is described as existing in four dimensions and being bound by eight cubes, with the acknowledgment that human beings struggle to visualize dimensions higher than three.', 'The concept of dimensions is explained, starting from zero dimensions to four dimensions, with examples of shapes existing in each dimension, such as points, lines, rectangles, and cubes.']}, {'end': 945.346, 'segs': [{'end': 450.117, 'src': 'embed', 'start': 401.895, 'weight': 0, 'content': [{'end': 406.019, 'text': 'But anyway, this is a wonderful, wonderful YouTube channel with many excellent explanatory videos.', 'start': 401.895, 'duration': 4.124}, {'end': 409.221, 'text': 'And this one about understanding 4D, the Tesseract, is excellent.', 'start': 406.339, 'duration': 2.882}, {'end': 412.745, 'text': 'So you can pause this, go watch that, come back later, all of the above.', 'start': 409.281, 'duration': 3.464}, {'end': 417.597, 'text': "Okay All right, so now, I think we're good, we're good, we're good.", 'start': 412.865, 'duration': 4.732}, {'end': 419.539, 'text': "I'm going to minimize the browser, and here I am, okay.", 'start': 417.637, 'duration': 1.902}, {'end': 423.063, 'text': 'All right now, what do I need?', 'start': 420.721, 'duration': 2.342}, {'end': 432.154, 'text': "The first thing I need to do if I'm going to make something 4D, to do something in 3D, I make heavy use of this idea of a P vector,", 'start': 423.083, 'duration': 9.071}, {'end': 435.638, 'text': 'which is a data structure that holds an X, Y and a Z.', 'start': 432.154, 'duration': 3.484}, {'end': 441.514, 'text': 'I need something that could hold an x, y, z, and a w for that fourth dimension.', 'start': 437.412, 'duration': 4.102}, {'end': 443.335, 'text': "So I'm going to make a new tab.", 'start': 442.034, 'duration': 1.301}, {'end': 445.896, 'text': "And I'm going to call it P4Vector.", 'start': 444.195, 'duration': 1.701}, {'end': 450.117, 'text': "And I'm going to say class P4Vector.", 'start': 445.916, 'duration': 4.201}], 'summary': 'The transcript discusses creating a p4vector for 4d visualization.', 'duration': 48.222, 'max_score': 401.895, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo401895.jpg'}, {'end': 718.406, 'src': 'embed', 'start': 682.775, 'weight': 1, 'content': [{'end': 690.803, 'text': 'The projection matrix to take a 4D point and turn it into, oh wait, x, y, z, w.', 'start': 682.775, 'duration': 8.028}, {'end': 694.907, 'text': 'and project it into something that I can draw into 3D.', 'start': 691.684, 'duration': 3.223}, {'end': 697.309, 'text': 'X, Y, Z.', 'start': 695.468, 'duration': 1.841}, {'end': 705.397, 'text': 'The idea is like, I want to look at the shadow of the 4D object in 3D, just like I might look at the shadow of a 3D object in 2D.', 'start': 697.309, 'duration': 8.088}, {'end': 714.944, 'text': 'So to do that, I need a matrix that has four columns, and three rows.', 'start': 706.778, 'duration': 8.166}, {'end': 718.406, 'text': 'So the typical way to do that would be like this.', 'start': 716.005, 'duration': 2.401}], 'summary': 'Using a 4x3 matrix to project 4d points into 3d space.', 'duration': 35.631, 'max_score': 682.775, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo682775.jpg'}, {'end': 794.705, 'src': 'heatmap', 'start': 763.194, 'weight': 1, 'content': [{'end': 767.277, 'text': 'as well as some helper stuff to do matrix multiplication with a matrix and a vector.', 'start': 763.194, 'duration': 4.083}, {'end': 771, 'text': "I'm going to have to change this to P4 vector, I'm just realizing that, but that's no problem.", 'start': 767.297, 'duration': 3.703}, {'end': 776.605, 'text': 'Okay, so what I first want to do is create that projection matrix.', 'start': 771.941, 'duration': 4.664}, {'end': 784.855, 'text': "So I'm just going to do it right here as a local variable, and maybe a little bit later it'll sort of make sense why.", 'start': 778.669, 'duration': 6.186}, {'end': 794.705, 'text': "So I'm going to say a float projection equals, so I need to make that matrix, which is an array of arrays.", 'start': 784.875, 'duration': 9.83}], 'summary': 'Creating a projection matrix using a float variable and arrays.', 'duration': 31.511, 'max_score': 763.194, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo763194.jpg'}], 'start': 378.518, 'title': 'Understanding 4d concepts and creating 4d projections', 'summary': 'Discusses a youtube video as a resource for understanding 4d concepts and covers creating a p4vector and projecting 4d points into 3d, encountering challenges with matrix multiplication and array handling.', 'chapters': [{'end': 423.063, 'start': 378.518, 'title': 'Understanding 4d tesseract', 'summary': 'Discusses a recommendation for a youtube video that explains the tesseract, suggesting it as a helpful resource for understanding 4d concepts.', 'duration': 44.545, 'highlights': ['The speaker highly recommends a YouTube channel with an excellent explanatory video about understanding 4D, the Tesseract.', 'The video is described as a condensed version of the explanation of the Tesseract and its workings.', 'The speaker mentions creating a coding challenge based on the particular video from the recommended YouTube channel.', 'The recommendation is made for viewers to pause the current video and watch the recommended explanatory video about the Tesseract.']}, {'end': 945.346, 'start': 423.083, 'title': 'Creating a 4d p4vector and projecting 4d points into 3d', 'summary': 'Covers the creation of a p4vector for holding 4d coordinates, the construction of a hypercube in 4d with 16 vertices, and the development of a projection matrix to project 4d points into 3d space, encountering challenges with matrix multiplication and array handling.', 'duration': 522.263, 'highlights': ['Creation of P4Vector with x, y, z, and w coordinates The process involves creating a new class called P4Vector with x, y, z, and w coordinates, allowing for the representation of 4D points.', 'Construction of a hypercube in 4D with 16 vertices The speaker extends an array to hold 16 points to represent a hypercube, comprising two cubes with all points connected, demonstrating manual data input and the relaxing nature of repetitive tasks.', 'Development of a projection matrix for projecting 4D points into 3D space The chapter delves into the creation of a projection matrix with four columns and three rows, essential for projecting 4D points into 3D space and drawing their shadows, encountering challenges with matrix multiplication and array handling.']}], 'duration': 566.828, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo378518.jpg', 'highlights': ['Creation of a P4Vector class with x, y, z, and w coordinates for representing 4D points.', 'Development of a projection matrix for projecting 4D points into 3D space, encountering challenges with matrix multiplication and array handling.', 'Recommendation for viewers to pause the current video and watch the recommended explanatory video about the Tesseract.', 'The speaker highly recommends a YouTube channel with an excellent explanatory video about understanding 4D, the Tesseract.']}, {'end': 1231.684, 'segs': [{'end': 989.532, 'src': 'embed', 'start': 947.347, 'weight': 2, 'content': [{'end': 948.767, 'text': "Whoa, okay, it's still the same.", 'start': 947.347, 'duration': 1.42}, {'end': 953.068, 'text': 'Why? There are eight points in four dimensions.', 'start': 950.367, 'duration': 2.701}, {'end': 953.748, 'text': 'Well, guess what?', 'start': 953.108, 'duration': 0.64}, {'end': 962.356, 'text': 'If I took a cube and I showed it to you in orthographic projection facing the camera, basically, it would look like just four points.', 'start': 954.249, 'duration': 8.107}, {'end': 969.5, 'text': "The four points on the back of the cube would be sitting right exactly behind the four points at the front, and you wouldn't see them as different.", 'start': 962.937, 'duration': 6.563}, {'end': 970.901, 'text': 'Same thing is going on here.', 'start': 969.86, 'duration': 1.041}, {'end': 974.643, 'text': 'So what I actually need is not orthographic projection.', 'start': 971.381, 'duration': 3.262}, {'end': 976.224, 'text': 'I need stereographic projection.', 'start': 974.723, 'duration': 1.501}, {'end': 977.665, 'text': 'I need to create that perspective.', 'start': 976.244, 'duration': 1.421}, {'end': 987.97, 'text': "And the way to do that is with moving, sort of thinking of a light source that has a certain distance from the object that I'm casting a shadow.", 'start': 978.085, 'duration': 9.885}, {'end': 989.532, 'text': "So I'm going to create a variable.", 'start': 988.23, 'duration': 1.302}], 'summary': 'Explaining the need for stereographic projection and creating a variable for light source distance.', 'duration': 42.185, 'max_score': 947.347, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo947347.jpg'}, {'end': 1062.265, 'src': 'embed', 'start': 1009.833, 'weight': 0, 'content': [{'end': 1026.559, 'text': "So that way, so I'm going to think of the camera as two sort of units away, and then the projection, W is one divided by that distance minus V dot W.", 'start': 1009.833, 'duration': 16.726}, {'end': 1031.102, 'text': 'This is a sort of tried and true formula for creating perspective projection.', 'start': 1026.559, 'duration': 4.543}, {'end': 1034.183, 'text': 'And then I can put that W in here.', 'start': 1031.682, 'duration': 2.501}, {'end': 1037.224, 'text': "And now, let's see what happens.", 'start': 1035.964, 'duration': 1.26}, {'end': 1041.829, 'text': "Oh my god, do we have four dimensions? Oh, I forgot, oh, I'm so close, I'm so close.", 'start': 1037.645, 'duration': 4.184}, {'end': 1045.492, 'text': "So I forgot that all my numbers are one, so I'm just going to scale.", 'start': 1042.089, 'duration': 3.403}, {'end': 1048.334, 'text': "there's a variety of ways I could scale things up, but I'm just going to do it right here.", 'start': 1045.492, 'duration': 2.842}, {'end': 1057.662, 'text': "So I'm going to multiply by 100, and now, oh, look at that! What kind of looks like, sort of looks like that Tesseract thing.", 'start': 1048.354, 'duration': 9.308}, {'end': 1061.685, 'text': 'Wait a second, wait a second, wait a second, wait a second, wait a second.', 'start': 1058.582, 'duration': 3.103}, {'end': 1062.265, 'text': 'Oh, this is crazy.', 'start': 1061.765, 'duration': 0.5}], 'summary': 'Demonstrating perspective projection and scaling by 100, leading to a tesseract-like result.', 'duration': 52.432, 'max_score': 1009.833, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1009833.jpg'}, {'end': 1131.646, 'src': 'embed', 'start': 1102.045, 'weight': 1, 'content': [{'end': 1117.463, 'text': "I'm going to make an array P vector projected, which is an array is a new P vector, also with 16 points in it,", 'start': 1102.045, 'duration': 15.418}, {'end': 1122.884, 'text': "and I'm just going to take projected 3D index i.", 'start': 1117.463, 'duration': 5.421}, {'end': 1124.384, 'text': "there's no index.", 'start': 1122.884, 'duration': 1.5}, {'end': 1126.265, 'text': "I'm going to add an index.", 'start': 1124.384, 'duration': 1.881}, {'end': 1128.285, 'text': "I'm using this enhanced loop.", 'start': 1126.265, 'duration': 2.02}, {'end': 1129.625, 'text': 'I probably should just make it a for loop.', 'start': 1128.285, 'duration': 1.34}, {'end': 1130.486, 'text': "let's make it a for loop.", 'start': 1129.625, 'duration': 0.861}, {'end': 1131.646, 'text': 'I got time to do that.', 'start': 1130.766, 'duration': 0.88}], 'summary': 'Creating a new p vector with 16 points and adding an index using a for loop.', 'duration': 29.601, 'max_score': 1102.045, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1102045.jpg'}], 'start': 947.347, 'title': '4d visualization and tesseract-like shape', 'summary': 'Covers creating perspective projection for 4d visualization using stereographic projection, exploring the tesseract through scaling up numbers, and discussing challenges in connecting points and vectors for projection and array manipulation.', 'chapters': [{'end': 1041.829, 'start': 947.347, 'title': 'Creating perspective projection', 'summary': 'Explains the concept of stereographic projection in creating perspective projection by using a light source to cast a shadow, with the formula w = 1 / (distance - v dot w), aiming to achieve a 4d visualization.', 'duration': 94.482, 'highlights': ['The chapter emphasizes the need for stereographic projection to create perspective, using a light source to cast a shadow and a formula W = 1 / (distance - V dot W) to achieve the visualization of 4 dimensions.', 'The speaker discusses the normalization of the shape by replacing all occurrences of 100 with 1, emphasizing the process of preparing the shape for projection.', 'The concept of orthographic projection is compared to stereographic projection, highlighting the difference in visual representation and the need for perspective.', "The speaker mentions the challenge of creating a perspective visualization and the need to manipulate a variable 'distance' in the formula for projection.", 'The chapter addresses the visual illusion caused by orthographic projection, explaining how the points at the back of the cube align with the points at the front, creating the need for a different approach.']}, {'end': 1080.029, 'start': 1042.089, 'title': 'Exploring the tesseract', 'summary': 'Explores scaling up numbers and creating a tesseract-like shape using multiplication, emphasizing the challenge of visualizing the fourth dimension.', 'duration': 37.94, 'highlights': ['The speaker demonstrates scaling up numbers using multiplication, exemplifying by multiplying by 100.', 'The creation of a shape resembling a Tesseract is observed during the scaling process.', 'The challenge of visualizing the fourth dimension is emphasized, with the speaker expressing the difficulty of comprehending it visually.', 'The process of connecting lines to form the Tesseract-like shape is highlighted as an essential step in visualizing the concept.']}, {'end': 1231.684, 'start': 1081.488, 'title': 'Connecting points and vectors', 'summary': 'Discusses connecting points and vectors, iterating through an array, and the challenges faced in the process of projection and array manipulation.', 'duration': 150.196, 'highlights': ['The speaker discusses the process of connecting points and vectors in a program, aiming to create a new array with 16 points and iterating through it using an enhanced loop, subsequently opting to switch to a for loop for efficiency.', 'The speaker encounters challenges in determining the correct indices for array manipulation and projection, leading to confusion and out-of-bounds errors, eventually recognizing the need to ensure self-contained videos for clarity and understanding.']}], 'duration': 284.337, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo947347.jpg', 'highlights': ['The chapter emphasizes the need for stereographic projection to create perspective, using a light source to cast a shadow and a formula W = 1 / (distance - V dot W) to achieve the visualization of 4 dimensions.', 'The speaker discusses the process of connecting points and vectors in a program, aiming to create a new array with 16 points and iterating through it using an enhanced loop, subsequently opting to switch to a for loop for efficiency.', 'The concept of orthographic projection is compared to stereographic projection, highlighting the difference in visual representation and the need for perspective.', 'The creation of a shape resembling a Tesseract is observed during the scaling process.', 'The challenge of visualizing the fourth dimension is emphasized, with the speaker expressing the difficulty of comprehending it visually.']}, {'end': 1999.664, 'segs': [{'end': 1267.116, 'src': 'embed', 'start': 1231.724, 'weight': 1, 'content': [{'end': 1235.585, 'text': "And there's a few things that you might have to watch a previous video for.", 'start': 1231.724, 'duration': 3.861}, {'end': 1239.226, 'text': "But I think it's worth explaining this just for a second.", 'start': 1235.845, 'duration': 3.381}, {'end': 1248.488, 'text': 'So basically what I did in this connect function is this is a connect function to just take two of the points and draw a line between them.', 'start': 1240.486, 'duration': 8.002}, {'end': 1253.149, 'text': 'And to draw a cube, normally I might just say box or begin shape, end shape.', 'start': 1248.848, 'duration': 4.301}, {'end': 1255.65, 'text': "And it's going to sort of like make all these connections for me.", 'start': 1253.189, 'duration': 2.461}, {'end': 1267.116, 'text': "But what I'm doing is I basically have points zero one, two, three, four, five.", 'start': 1255.99, 'duration': 11.126}], 'summary': 'Explanation of connect function to draw lines between points in a cube.', 'duration': 35.392, 'max_score': 1231.724, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1231724.jpg'}, {'end': 1397.375, 'src': 'embed', 'start': 1345.969, 'weight': 0, 'content': [{'end': 1351.274, 'text': 'And then that offset could be seven, right? Because then I just want to do this.', 'start': 1345.969, 'duration': 5.305}, {'end': 1356.818, 'text': 'And so this would just be i plus offset, j plus offset.', 'start': 1351.834, 'duration': 4.984}, {'end': 1365.656, 'text': 'So if I do this twice, And again, I could do this in one loop.', 'start': 1358.4, 'duration': 7.256}, {'end': 1368.581, 'text': "I could add an offset that's 8.", 'start': 1366.337, 'duration': 2.244}, {'end': 1372.466, 'text': "Is it 8? I think it's 8.", 'start': 1368.581, 'duration': 3.885}, {'end': 1372.866, 'text': 'There we go.', 'start': 1372.466, 'duration': 0.4}, {'end': 1375.987, 'text': "So now you can see I've connected both cubes.", 'start': 1373.746, 'duration': 2.241}, {'end': 1386.651, 'text': "So now, interestingly enough, what's the fourth dimension with this kind of perspective? The fourth dimension is actually, like, is w.", 'start': 1376.407, 'duration': 10.244}, {'end': 1389.332, 'text': 'w is expressed as kind of the distance between these cubes.', 'start': 1386.651, 'duration': 2.681}, {'end': 1393.454, 'text': 'I mean, again, we can only think about it in, I can only describe it to you in three-dimensional terms.', 'start': 1389.352, 'duration': 4.102}, {'end': 1397.375, 'text': 'So for example, you see this here.', 'start': 1394.834, 'duration': 2.541}], 'summary': 'Describing the connection between cubes and the fourth dimension with an offset of 8.', 'duration': 51.406, 'max_score': 1345.969, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1345969.jpg'}, {'end': 1600.366, 'src': 'embed', 'start': 1573.523, 'weight': 4, 'content': [{'end': 1577.445, 'text': "So if I look at the distance between all the points, I'll find all the connections there.", 'start': 1573.523, 'duration': 3.922}, {'end': 1580.706, 'text': "So that's an interesting side project for any of you as an exercise to do while you're watching this.", 'start': 1577.465, 'duration': 3.241}, {'end': 1582.627, 'text': 'But I want to talk about rotation now.', 'start': 1581.146, 'duration': 1.481}, {'end': 1588.913, 'text': "So how is this rotation even happening in the first place? I'm rotating in the third dimension, which is not really what I want to do.", 'start': 1583.027, 'duration': 5.886}, {'end': 1592.938, 'text': 'I want to rotate in the fourth dimension, then project that down to the third dimension.', 'start': 1589.014, 'duration': 3.924}, {'end': 1594.219, 'text': "So let's try to back up.", 'start': 1593.138, 'duration': 1.081}, {'end': 1600.366, 'text': "Let's try to create exactly this by rotating in the fourth dimension and then projecting back down to the third dimension.", 'start': 1594.239, 'duration': 6.127}], 'summary': 'Discussing rotation in dimensions, aiming to rotate in fourth dimension and project to third dimension.', 'duration': 26.843, 'max_score': 1573.523, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1573523.jpg'}, {'end': 1726.517, 'src': 'embed', 'start': 1697.219, 'weight': 2, 'content': [{'end': 1699.221, 'text': 'But I want to do this in four dimensions.', 'start': 1697.219, 'duration': 2.002}, {'end': 1705.987, 'text': 'So what I need to do a rotation in four dimensions is the following.', 'start': 1699.762, 'duration': 6.225}, {'end': 1709.027, 'text': 'I need to pick which axes I want.', 'start': 1707.085, 'duration': 1.942}, {'end': 1711.169, 'text': 'And I need a 4 by 4 matrix.', 'start': 1709.307, 'duration': 1.862}, {'end': 1717.194, 'text': "And in this case, the axes that I want, I'm going to use the x and y axes.", 'start': 1713.19, 'duration': 4.004}, {'end': 1726.517, 'text': "and I'm going to say cosine theta, negative sine theta, sine theta, cosine theta.", 'start': 1718.669, 'duration': 7.848}], 'summary': 'To perform a rotation in four dimensions, a 4x4 matrix is used with specified axes and trigonometric functions.', 'duration': 29.298, 'max_score': 1697.219, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1697219.jpg'}], 'start': 1231.724, 'title': '3d and 4d visualizations', 'summary': 'Delves into drawing 3d cubes with the connect function, detailing point connections and offset addition, and also explores 4d rotation and projection, addressing visualization challenges and the use of rotation matrices.', 'chapters': [{'end': 1375.987, 'start': 1231.724, 'title': 'Drawing 3d cubes with connect function', 'summary': 'Discusses the process of drawing 3d cubes using the connect function, specifying the connections between points and adding an offset to connect multiple cubes.', 'duration': 144.263, 'highlights': ['The connect function is used to draw a line between points, and in this case, it is used to connect specific points to create a 3D cube, as demonstrated by the connections between points 0, 1, 2, 3, 4, 5, 6, and 7.', "The process involves adding an offset to connect multiple cubes, with the speaker considering using an offset of zero and seven to achieve the connections between the cubes' points.", 'The speaker mentions the possibility of refactoring the process to achieve a better approach, expressing openness to suggestions for improvement.']}, {'end': 1999.664, 'start': 1376.407, 'title': '4d rotation and projection', 'summary': 'Covers the concept of the fourth dimension in 3d perspective, debugging a problem in visualizing connections in a hypercube, and implementing 4d rotation using rotation matrices and matrix multiplication.', 'duration': 623.257, 'highlights': ['Debugging visualization connections in a hypercube The speaker spends about 45 minutes debugging a problem in visualizing connections in a hypercube, ultimately finding the mistake in the perspective projection formula.', 'Implementing 4D rotation using rotation matrices and matrix multiplication The chapter explains the process of implementing 4D rotation using rotation matrices and matrix multiplication, highlighting the creation of rotation matrices for various axes and the use of matrix multiplication to obtain the rotated point.', 'Explanation of the concept of the fourth dimension in 3D perspective The speaker describes the concept of the fourth dimension in 3D perspective, using w as the distance between cubes and the need for visualization connections to be fully complete.']}], 'duration': 767.94, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo1231724.jpg', 'highlights': ["The process involves adding an offset to connect multiple cubes, with the speaker considering using an offset of zero and seven to achieve the connections between the cubes' points.", 'The connect function is used to draw a line between points, and in this case, it is used to connect specific points to create a 3D cube, as demonstrated by the connections between points 0, 1, 2, 3, 4, 5, 6, and 7.', 'Implementing 4D rotation using rotation matrices and matrix multiplication The chapter explains the process of implementing 4D rotation using rotation matrices and matrix multiplication, highlighting the creation of rotation matrices for various axes and the use of matrix multiplication to obtain the rotated point.', 'Explanation of the concept of the fourth dimension in 3D perspective The speaker describes the concept of the fourth dimension in 3D perspective, using w as the distance between cubes and the need for visualization connections to be fully complete.', 'Debugging visualization connections in a hypercube The speaker spends about 45 minutes debugging a problem in visualizing connections in a hypercube, ultimately finding the mistake in the perspective projection formula.']}, {'end': 2536.378, 'segs': [{'end': 2093.44, 'src': 'embed', 'start': 2061.187, 'weight': 2, 'content': [{'end': 2073.382, 'text': "Then, now I want to get the w of the rotated vector, right? Because I'm about to calculate the projection matrix.", 'start': 2061.187, 'duration': 12.195}, {'end': 2075.344, 'text': "I don't want to use the original point.", 'start': 2073.641, 'duration': 1.703}, {'end': 2078.246, 'text': "I want to use the point that's been calculated after the rotation.", 'start': 2075.664, 'duration': 2.582}, {'end': 2079.367, 'text': 'And now we should see.', 'start': 2078.347, 'duration': 1.02}, {'end': 2085.753, 'text': 'Wait Aha.', 'start': 2083.67, 'duration': 2.083}, {'end': 2090.117, 'text': 'I projected v again.', 'start': 2087.855, 'duration': 2.262}, {'end': 2093.44, 'text': 'So this down here needs to be rotated also.', 'start': 2090.377, 'duration': 3.063}], 'summary': 'Calculating projection matrix after rotating vector.', 'duration': 32.253, 'max_score': 2061.187, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo2061187.jpg'}, {'end': 2223.205, 'src': 'embed', 'start': 2196.448, 'weight': 3, 'content': [{'end': 2201.774, 'text': 'of what the four dimensional shape in our only way our brains can process, 3D.', 'start': 2196.448, 'duration': 5.326}, {'end': 2205.138, 'text': "But let's really try to stretch our brains for a second.", 'start': 2202.235, 'duration': 2.903}, {'end': 2209.063, 'text': 'What if I include, this is really where things are going to go nuts.', 'start': 2206.119, 'duration': 2.944}, {'end': 2216.452, 'text': 'What if I include the W axis? What does it mean to rotate around the W axis? Think about that for a second.', 'start': 2209.624, 'duration': 6.828}, {'end': 2223.205, 'text': 'Okay, rotate around the y, rotate around the x, rotate around the z.', 'start': 2217.022, 'duration': 6.183}], 'summary': 'Exploring the concept of rotating in a four-dimensional space.', 'duration': 26.757, 'max_score': 2196.448, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo2196448.jpg'}, {'end': 2498.173, 'src': 'embed', 'start': 2424.078, 'weight': 0, 'content': [{'end': 2429.981, 'text': "Now this should look like the tesseract visualization that you're used to seeing.", 'start': 2424.078, 'duration': 5.903}, {'end': 2433.082, 'text': 'This is that w rotation, like rotating.', 'start': 2430.401, 'duration': 2.681}, {'end': 2441.326, 'text': 'And by the way, we have now entered the fourth dimension.', 'start': 2433.122, 'duration': 8.204}, {'end': 2444.728, 'text': "You know, it's a little bit anticlimactic, I guess.", 'start': 2442.647, 'duration': 2.081}, {'end': 2446.349, 'text': "But here, we're done.", 'start': 2445.088, 'duration': 1.261}, {'end': 2447.83, 'text': 'This coding challenge is complete.', 'start': 2446.369, 'duration': 1.461}, {'end': 2450.1, 'text': 'I just want to stop.', 'start': 2449.139, 'duration': 0.961}, {'end': 2454.425, 'text': "I'm not going to do any more because I'm going to leave this for you.", 'start': 2450.741, 'duration': 3.684}, {'end': 2460.591, 'text': "Let's think about all the kinds of things you could do to this to make this more beautiful or interesting or weird.", 'start': 2454.525, 'duration': 6.066}, {'end': 2466.538, 'text': 'First of all, what are all sorts of other rotation matrices you can apply?', 'start': 2461.252, 'duration': 5.286}, {'end': 2468.56, 'text': "What's like a three-axis rotation?", 'start': 2466.698, 'duration': 1.862}, {'end': 2470.362, 'text': 'You could certainly do that right?', 'start': 2468.6, 'duration': 1.762}, {'end': 2474.111, 'text': 'What multi, how many?', 'start': 2472.87, 'duration': 1.241}, {'end': 2475.352, 'text': 'this is a double rotation.', 'start': 2474.111, 'duration': 1.241}, {'end': 2476.914, 'text': 'could you do a triple, a quadruple??', 'start': 2475.352, 'duration': 1.562}, {'end': 2481.037, 'text': 'What if you try a bunch of different other axes with the W axis?', 'start': 2477.194, 'duration': 3.843}, {'end': 2487.17, 'text': "You know, I'm just drawing these little Points and connecting them with lines.", 'start': 2481.057, 'duration': 6.113}, {'end': 2492.591, 'text': 'there are probably so many other ways you could think to visualize the pattern of the tesseract.', 'start': 2487.17, 'duration': 5.421}, {'end': 2498.173, 'text': 'You can now enter the fourth dimension, Project it into the third dimension and see a result.', 'start': 2492.591, 'duration': 5.582}], 'summary': 'Tesseract visualization with fourth dimension rotation challenge completed.', 'duration': 74.095, 'max_score': 2424.078, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo2424078.jpg'}], 'start': 2000.125, 'title': 'Implementing 3d rotations in code and exploring the fourth dimension', 'summary': 'Covers implementing 3d rotations in code, creating rotation matrices, applying multiple rotations, and exploring the concept of the fourth dimension through rotations around different axes, with an emphasis on visualizing the tesseract in 3d and encouraging experimentation.', 'chapters': [{'end': 2194.856, 'start': 2000.125, 'title': 'Implementing 3d rotations in code', 'summary': 'Covers implementing 3d rotations in code, including creating rotation matrices and applying multiple rotations to achieve visual effects, with an emphasis on the process of implementing the transformations.', 'duration': 194.731, 'highlights': ['The process of creating rotation matrices and applying them to achieve 3D rotations is detailed, showcasing the iterative development of the code and the visual effects achieved with the rotations.', 'The challenges and solutions encountered during the process of implementing 3D rotations in code are discussed, highlighting the iterative nature of development and the need for efficient variable usage.', 'The importance of using the calculated point after rotation rather than the original point for further calculations is emphasized, demonstrating the practical implications of the 3D rotations in the context of projecting vectors and creating visual effects.']}, {'end': 2536.378, 'start': 2196.448, 'title': 'Exploring the fourth dimension', 'summary': 'Explores the concept of the fourth dimension through rotations around different axes, specifically focusing on the w axis, visualizing the tesseract in 3d, and encouraging experimentation with multi-axis rotations and different visualization techniques.', 'duration': 339.93, 'highlights': ['The concept of the fourth dimension is explored through rotations around different axes, particularly focusing on the W axis. The speaker delves into the implications of including the W axis in rotations, challenging the audience to think about the effects of rotating around this axis, providing a unique perspective on the concept of the fourth dimension.', 'Visualization of the tesseract in 3D is discussed, emphasizing the significance of rotations and projection into the third dimension. The speaker demonstrates the process of visualizing the tesseract in 3D, highlighting the effects of rotations and projections, inviting the audience to experiment with different visualization techniques to create unique art.', 'Encouragement for experimentation with multi-axis rotations, different visualization methods, and projection into lower dimensions is conveyed. The speaker encourages the audience to experiment with multi-axis rotations, different visualization techniques, and projection into lower dimensions, prompting them to explore the possibilities of visualizing higher dimensions and creating unconventional art.']}], 'duration': 536.253, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/XE3YDVdQSPo/pics/XE3YDVdQSPo2000125.jpg', 'highlights': ['The process of creating rotation matrices and applying them to achieve 3D rotations is detailed, showcasing the iterative development of the code and the visual effects achieved with the rotations.', 'The challenges and solutions encountered during the process of implementing 3D rotations in code are discussed, highlighting the iterative nature of development and the need for efficient variable usage.', 'The importance of using the calculated point after rotation rather than the original point for further calculations is emphasized, demonstrating the practical implications of the 3D rotations in the context of projecting vectors and creating visual effects.', 'The concept of the fourth dimension is explored through rotations around different axes, particularly focusing on the W axis. The speaker delves into the implications of including the W axis in rotations, challenging the audience to think about the effects of rotating around this axis, providing a unique perspective on the concept of the fourth dimension.', 'Visualization of the tesseract in 3D is discussed, emphasizing the significance of rotations and projection into the third dimension. The speaker demonstrates the process of visualizing the tesseract in 3D, highlighting the effects of rotations and projections, inviting the audience to experiment with different visualization techniques to create unique art.', 'Encouragement for experimentation with multi-axis rotations, different visualization methods, and projection into lower dimensions is conveyed. The speaker encourages the audience to experiment with multi-axis rotations, different visualization techniques, and projection into lower dimensions, prompting them to explore the possibilities of visualizing higher dimensions and creating unconventional art.']}], 'highlights': ['The potential to create 4D, 5D, 6D, and 7D shapes in the P3D renderer, requiring matrices for projection and rotation.', 'The process of projecting and visualizing higher-dimensional shapes on a 2D computer screen using matrices and rotation.', 'Creation of a P4Vector class with x, y, z, and w coordinates for representing 4D points.', 'Development of a projection matrix for projecting 4D points into 3D space, encountering challenges with matrix multiplication and array handling.', 'The chapter emphasizes the need for stereographic projection to create perspective, using a light source to cast a shadow and a formula W = 1 / (distance - V dot W) to achieve the visualization of 4 dimensions.', "The process involves adding an offset to connect multiple cubes, with the speaker considering using an offset of zero and seven to achieve the connections between the cubes' points.", 'Implementing 4D rotation using rotation matrices and matrix multiplication The chapter explains the process of implementing 4D rotation using rotation matrices and matrix multiplication, highlighting the creation of rotation matrices for various axes and the use of matrix multiplication to obtain the rotated point.', 'The process of creating rotation matrices and applying them to achieve 3D rotations is detailed, showcasing the iterative development of the code and the visual effects achieved with the rotations.', 'The challenges and solutions encountered during the process of implementing 3D rotations in code are discussed, highlighting the iterative nature of development and the need for efficient variable usage.', 'The importance of using the calculated point after rotation rather than the original point for further calculations is emphasized, demonstrating the practical implications of the 3D rotations in the context of projecting vectors and creating visual effects.']}