title
Coding Challenge #17: Fractal Trees - Space Colonization

description
In this coding challenge, I'm using the space colonization algorithm to make a tree generator. This is the 4th part of my algorithmic botany series. Code: https://thecodingtrain.com/challenges/17-fractal-trees-space-colonization 🕹ī¸ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/r9pxis9g- đŸŽĨ Previous video: https://youtu.be/E1B4UoSQMFw?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH đŸŽĨ Next video: https://youtu.be/JcopTKXt8L8?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH đŸŽĨ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH References: đŸŒŗ Algorithmic Botany: http://algorithmicbotany.org/ 📓 Space Colonization Algorithm: https://algorithmicbotany.org/papers/colonization.egwnp2007.html 📕 Nature of Code class on Kadenze: https://www.kadenze.com/courses/the-nature-of-code/info Videos: đŸŽĨ Algorithmic Botany Track: https://thecodingtrain.com/tracks/algorithmic-botany 🔴 Coding Train Live 40: https://youtu.be/MwLyeEWnMCY?t=7899s Related Coding Challenges: 🚂 #14 Recursive Fractal Trees: https://youtu.be/0jjeOYMjmDU 🚂 #18 3D Fractal Trees: https://youtu.be/JcopTKXt8L8 🚂 #77 Recursion: https://youtu.be/jPsZwrV9ld0 🚂 #174 AppleSoft Basic Fractal Tree: https://youtu.be/UNkHditYGls Timestamps: 0:00 Introducing today's topic 1:34 The space colonization algorithm 3:11 Write a Tree constructor function 3:46 Write a Leaf construction function 5:03 Add a tree 6:53 Create a branch object that has a position and a parent 7:45 Add the root of the tree 9:26 Add a direction to the branch 10:41 Minimum and maximum distance 14:45 Add a function to add the next branch 17:35 Add a show function 20:00 Add a grow function to determine the closest branch to each leaf 22:20 Mark leaves that are reached 28:06 "Pull" the direction of closest branch toward the leaf 30:00 Add a count variable to the Branch variable 32:06 Loop backwards through the leaf array to delete leaves that were reached 33:02 Determine whether a branch was attracted to a leaf 34:01 Average the branch's direction 34:30 Make a new branch 36:59 Reset the branches 42:55 Add a default length to the branches 43:50 Suggestions for improvements 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://discord.gg/hPuGy2g 💖 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 #fractals #generativeart #spacecolonization #p5js #javascript

detail
{'title': 'Coding Challenge #17: Fractal Trees - Space Colonization', 'heatmap': [{'end': 1681.139, 'start': 1648.226, 'weight': 1}], 'summary': 'Explores the space colonization algorithm for 2d leaves and discusses tree growth algorithms, creating and attracting branch objects, tree branch algorithm, growth and interaction algorithms, and debugging tree function, providing insights on algorithms, techniques, and optimizations to create and grow fractal trees.', 'chapters': [{'end': 99.872, 'segs': [{'end': 57.988, 'src': 'embed', 'start': 0.569, 'weight': 0, 'content': [{'end': 3.81, 'text': 'Welcome to one more coding challenge about trees.', 'start': 0.569, 'duration': 3.241}, {'end': 10.413, 'text': "And in this coding challenge, I'm going to use an algorithm called space colonization, which does not have to do with colonizing space,", 'start': 3.97, 'duration': 6.443}, {'end': 11.413, 'text': 'although that would be interesting.', 'start': 10.413, 'duration': 1}, {'end': 15.775, 'text': "It's really about colonizing a two-dimensional space of leaves in the screen.", 'start': 11.733, 'duration': 4.042}, {'end': 18.556, 'text': "And you'll see how that makes sense as soon as I start to diagram this out.", 'start': 15.795, 'duration': 2.761}, {'end': 25.618, 'text': 'So first I want to mention this algorithm is from a 2007 paper that you can read on algorithmicbotany.org.', 'start': 18.856, 'duration': 6.762}, {'end': 27.379, 'text': "I'll include a link in this video's description.", 'start': 25.638, 'duration': 1.741}, {'end': 37.429, 'text': 'There is also a tutorial that I used in preparation for this from the Sea of Beans website, which goes through this space colonization algorithm,', 'start': 27.859, 'duration': 9.57}, {'end': 41.172, 'text': "and I'll also include a link to this particular tutorial as well.", 'start': 37.429, 'duration': 3.743}, {'end': 46.518, 'text': "So I'm going to do it in this video simply in two dimensions in JavaScript.", 'start': 41.393, 'duration': 5.125}, {'end': 49.1, 'text': "That's a processing version that I already made earlier this morning.", 'start': 46.578, 'duration': 2.522}, {'end': 50.662, 'text': "I'm going to program it again from scratch.", 'start': 49.16, 'duration': 1.502}, {'end': 57.988, 'text': "in JavaScript and then in a separate video I'm going to extend the concepts into 3D to see if we can create a tree in three dimensions.", 'start': 51.062, 'duration': 6.926}], 'summary': 'Coding challenge on space colonization algorithm for 2d tree simulation.', 'duration': 57.419, 'max_score': 0.569, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY569.jpg'}], 'start': 0.569, 'title': 'Space colonization algorithm', 'summary': "Explores the space colonization algorithm for two-dimensional space of leaves, referencing a 2007 paper and a tutorial, with plans to extend the concepts into 3d, and explains the algorithm's fundamental difference from traditional fractal tree algorithms.", 'chapters': [{'end': 99.872, 'start': 0.569, 'title': 'Coding challenge: space colonization algorithm', 'summary': "Explores the space colonization algorithm for two-dimensional space of leaves in the screen, referencing a 2007 paper from algorithmicbotany.org and a tutorial from sea of beans website, with plans to extend the concepts into 3d, and explains the algorithm's fundamental difference from traditional fractal tree algorithms.", 'duration': 99.303, 'highlights': ['The algorithm is from a 2007 paper on algorithmicbotany.org and a tutorial from Sea of Beans website. References the original source of the space colonization algorithm.', 'Plans to extend the concepts into 3D to create a tree in three dimensions. Outlines the plan to extend the algorithm into 3D space for creating three-dimensional trees.', 'Explains the fundamental difference of the space colonization algorithm from traditional fractal tree algorithms. Highlights the unique approach of space colonization algorithm compared to traditional fractal tree algorithms.']}], 'duration': 99.303, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY569.jpg', 'highlights': ['References the original source of the space colonization algorithm.', 'Outlines the plan to extend the algorithm into 3D space for creating three-dimensional trees.', 'Highlights the unique approach of space colonization algorithm compared to traditional fractal tree algorithms.']}, {'end': 344.242, 'segs': [{'end': 160.775, 'src': 'embed', 'start': 99.872, 'weight': 0, 'content': [{'end': 110.965, 'text': 'like creating something sort of tree like like this, that is filled with leaves and the leaves are represented as dots, and So, in other words,', 'start': 99.872, 'duration': 11.093}, {'end': 116.248, 'text': 'in a way, instead of growing from the bottom and reaching the end, this algorithm starts with the end.', 'start': 110.965, 'duration': 5.283}, {'end': 119.33, 'text': 'Like just a random sea of dots, those are all the leaves.', 'start': 116.509, 'duration': 2.821}, {'end': 125.775, 'text': 'Then what happens is you create these segments, and each segment is attached to another segment.', 'start': 119.871, 'duration': 5.904}, {'end': 135.981, 'text': 'And once the segment starts to get close to leaves, it becomes attracted, almost like gravitational attraction to those leaves.', 'start': 126.335, 'duration': 9.646}, {'end': 143.025, 'text': 'And when it gets attracted to a leaf, it spawns another branch which then, as it goes more for our segment, which, as it goes more forward,', 'start': 136.001, 'duration': 7.024}, {'end': 145.586, 'text': 'might start to get attracted to another branch.', 'start': 143.025, 'duration': 2.561}, {'end': 148.028, 'text': 'So this is sort of the basic idea.', 'start': 145.787, 'duration': 2.241}, {'end': 156.232, 'text': 'And as I start to write the code and get the code for the branches, the segments, the branch segments and the tree and the leaves going,', 'start': 148.048, 'duration': 8.184}, {'end': 159.714, 'text': "we'll start to see a little more of the nitty gritty of how this algorithm really works.", 'start': 156.232, 'duration': 3.482}, {'end': 160.775, 'text': "And I'll come back to this diagram.", 'start': 159.734, 'duration': 1.041}], 'summary': 'Algorithm creates tree-like structure from random dots, attracted to leaves to spawn branches.', 'duration': 60.903, 'max_score': 99.872, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY99872.jpg'}, {'end': 237.471, 'src': 'embed', 'start': 185.046, 'weight': 3, 'content': [{'end': 188.528, 'text': "So the first thing I'm going to do is write a constructor function for a tree.", 'start': 185.046, 'duration': 3.482}, {'end': 196.421, 'text': "And in that tree, I'm going to have an array of leaves.", 'start': 191.92, 'duration': 4.501}, {'end': 204.802, 'text': "And when you first make a tree, I want to create, and let's just start with 100 leaves.", 'start': 198.121, 'duration': 6.681}, {'end': 207.703, 'text': 'So I need some way of creating all the leaves at first.', 'start': 205.082, 'duration': 2.621}, {'end': 212.304, 'text': "So I'm going to say this.leaves.push a new leaf.", 'start': 208.143, 'duration': 4.161}, {'end': 217.524, 'text': 'So the very first thing I need to do is just create all those leaves that are going to be in the canvas.', 'start': 213.304, 'duration': 4.22}, {'end': 222.743, 'text': "So I've got that and now leaf.", 'start': 217.985, 'duration': 4.758}, {'end': 230.167, 'text': 'I now Want to write a function for a leaf, and a leaf is just something with a position.', 'start': 222.743, 'duration': 7.424}, {'end': 237.471, 'text': "So this dot position equals create vector, and what I'm going to do actually, for simplicity, is just make a random location in the canvas,", 'start': 230.167, 'duration': 7.304}], 'summary': 'Creating a tree constructor with 100 leaves and defining leaf positions.', 'duration': 52.425, 'max_score': 185.046, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY185046.jpg'}, {'end': 352.62, 'src': 'embed', 'start': 325.551, 'weight': 5, 'content': [{'end': 332.415, 'text': 'Now, how the tree is actually going to look, where you place those leaves randomly can really make a difference.', 'start': 325.551, 'duration': 6.864}, {'end': 333.395, 'text': 'Are they within a box?', 'start': 332.455, 'duration': 0.94}, {'end': 334.296, 'text': 'are they within a circle?', 'start': 333.395, 'duration': 0.901}, {'end': 335.677, 'text': 'are they in kind of like a heart shape?', 'start': 334.296, 'duration': 1.381}, {'end': 338.819, 'text': "So there's a lot of possibilities there, but this is kind of the basic idea.", 'start': 335.697, 'duration': 3.122}, {'end': 342.281, 'text': "And I'm actually, we could see what happens if I create 500 of them.", 'start': 339.519, 'duration': 2.762}, {'end': 344.242, 'text': "Now there's many more leaves in the window.", 'start': 342.641, 'duration': 1.601}, {'end': 352.62, 'text': 'So now what I need to do next is create a branch, the root of the tree.', 'start': 345.697, 'duration': 6.923}], 'summary': "Randomly placing leaves in different shapes can impact the tree's appearance. creating 500 leaves resulted in many more in the window.", 'duration': 27.069, 'max_score': 325.551, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY325551.jpg'}], 'start': 99.872, 'title': 'Tree growth algorithms', 'summary': 'Discusses algorithms for creating branching tree structures and generating trees with 100 leaves using javascript, offering a unique perspective on tree growth and the ability to explore different leaf patterns and quantities.', 'chapters': [{'end': 160.775, 'start': 99.872, 'title': 'Algorithm for branching tree growth', 'summary': 'Discusses an algorithm for creating a branching tree structure, which starts with a random sea of dots representing leaves, and then forms segments that are attracted to the leaves, spawning branches as they approach, providing a unique perspective on tree growth.', 'duration': 60.903, 'highlights': ['The algorithm starts with a random sea of dots representing leaves and then creates segments that are attracted to the leaves, spawning branches as they approach.', 'The segments are attracted to the leaves almost like gravitational attraction, and as they get close to a leaf, they spawn another branch and may start to get attracted to another branch.', 'The discussion delves into the nitty gritty of how the algorithm works as the code for the branches, segments, and the tree is developed.']}, {'end': 344.242, 'start': 161.095, 'title': 'Creating tree with leaves', 'summary': 'Discusses the process of creating a tree with 100 leaves represented as circles on a canvas using javascript, with the possibility of exploring different leaf placement patterns and quantities.', 'duration': 183.147, 'highlights': ['The first step is to write a constructor function for a tree, which includes an array of 100 leaves, each represented as a circle on the canvas. The chapter emphasizes the initial step of creating a constructor function for a tree with an array of 100 leaves and the representation of each leaf as a circle on the canvas.', 'The process involves creating a function for a leaf, where each leaf is assigned a random position on the canvas. A key aspect involves assigning a random position to each leaf on the canvas, contributing to the overall visual representation of the tree.', 'The chapter also explores the possibility of adjusting the quantity and placement patterns of the leaves to create different visual effects, such as placing 500 leaves on the canvas. The discussion includes the exploration of varying the quantity and placement patterns of leaves to observe their impact on the overall visual representation, exemplified by the placement of 500 leaves.']}], 'duration': 244.37, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY99872.jpg', 'highlights': ['The algorithm starts with a random sea of dots representing leaves and then creates segments that are attracted to the leaves, spawning branches as they approach.', 'The segments are attracted to the leaves almost like gravitational attraction, and as they get close to a leaf, they spawn another branch and may start to get attracted to another branch.', 'The discussion delves into the nitty gritty of how the algorithm works as the code for the branches, segments, and the tree is developed.', 'The first step is to write a constructor function for a tree, which includes an array of 100 leaves, each represented as a circle on the canvas.', 'The process involves creating a function for a leaf, where each leaf is assigned a random position on the canvas.', 'The chapter also explores the possibility of adjusting the quantity and placement patterns of the leaves to create different visual effects, such as placing 500 leaves on the canvas.']}, {'end': 629.274, 'segs': [{'end': 443.446, 'src': 'embed', 'start': 404.381, 'weight': 1, 'content': [{'end': 405.521, 'text': "So we're going to start with that.", 'start': 404.381, 'duration': 1.14}, {'end': 411.463, 'text': "So what I'm going to do is I'm going to create a branch object.", 'start': 405.581, 'duration': 5.882}, {'end': 419.805, 'text': 'And the branch object is also going to have a position.', 'start': 416.924, 'duration': 2.881}, {'end': 423.326, 'text': "And it's going to have a parent.", 'start': 421.724, 'duration': 1.602}, {'end': 427.11, 'text': 'So its parent is another branch.', 'start': 425.248, 'duration': 1.862}, {'end': 439.342, 'text': "So its position is probably something that I'm going to want to get, maybe as an x and a y, or even better yet, as a position.", 'start': 429.212, 'duration': 10.13}, {'end': 443.446, 'text': 'And its parent I also want to get as a parent.', 'start': 440.783, 'duration': 2.663}], 'summary': 'Creating a branch object with position and parent. utilizing x and y coordinates or position for the object.', 'duration': 39.065, 'max_score': 404.381, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY404381.jpg'}, {'end': 503.112, 'src': 'embed', 'start': 470.62, 'weight': 2, 'content': [{'end': 473.18, 'text': "I'm going to weirdly start it in the middle of the window.", 'start': 470.62, 'duration': 2.56}, {'end': 474.52, 'text': 'I think that might be interesting.', 'start': 473.2, 'duration': 1.32}, {'end': 476.861, 'text': 'And so I need a vector.', 'start': 475.681, 'duration': 1.18}, {'end': 485.583, 'text': "So I'm going to say var position equals create vector in the middle of the canvas, width divided by 2, height divided by 2.", 'start': 477.381, 'duration': 8.202}, {'end': 489.004, 'text': "And I'm going to make a branch at that position.", 'start': 485.583, 'duration': 3.421}, {'end': 493.325, 'text': "And the root of the tree, what's its parent? It has no parent.", 'start': 489.464, 'duration': 3.861}, {'end': 495.486, 'text': "So I'm going to just say null.", 'start': 494.165, 'duration': 1.321}, {'end': 503.112, 'text': 'So the root is a kind of special case in which that it has no parent.', 'start': 496.047, 'duration': 7.065}], 'summary': 'Creating a vector at the midpoint of canvas with width and height divided by 2, making a branch at the position, and defining the root as a special case with no parent.', 'duration': 32.492, 'max_score': 470.62, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY470620.jpg'}, {'end': 598.782, 'src': 'embed', 'start': 525.6, 'weight': 0, 'content': [{'end': 533.6, 'text': 'So by definition, the way that this attraction algorithm is going to work Imagine there are like three leaves here, and I have a branch here.', 'start': 525.6, 'duration': 8}, {'end': 539.465, 'text': "The branch, by definition, needs to have a direction, a direction that it's pointing.", 'start': 534.101, 'duration': 5.364}, {'end': 542.247, 'text': 'Because the next branch is the next segment.', 'start': 539.845, 'duration': 2.402}, {'end': 543.648, 'text': 'And really, I should use the word segment.', 'start': 542.287, 'duration': 1.361}, {'end': 546.59, 'text': 'The next segment is going to be added at the end.', 'start': 543.688, 'duration': 2.902}, {'end': 552.574, 'text': "And it's going to get a copy of its direction, but it's going to get pulled toward the closest leaf,", 'start': 547.15, 'duration': 5.424}, {'end': 556.337, 'text': "which is what's going to cause this kind of meandering of all of these segments.", 'start': 552.574, 'duration': 3.763}, {'end': 564, 'text': 'So what I need to do in addition is give, where am I? I need to be in branch.', 'start': 556.857, 'duration': 7.143}, {'end': 565.981, 'text': 'Each branch needs to have a direction.', 'start': 564.34, 'duration': 1.641}, {'end': 571.802, 'text': 'So the direction is also something that I can get from the constructor.', 'start': 566.901, 'duration': 4.901}, {'end': 580.144, 'text': 'And so when I make that root, I need to, and where do I do that in tree? I need to also give it a direction.', 'start': 572.342, 'duration': 7.802}, {'end': 583.645, 'text': 'So I think the order of my arguments here is a little bit weird.', 'start': 580.204, 'duration': 3.441}, {'end': 586.086, 'text': 'I make a new branch, add a position.', 'start': 583.985, 'duration': 2.101}, {'end': 590.25, 'text': 'and then and null is the parent.', 'start': 587.046, 'duration': 3.204}, {'end': 591.152, 'text': "let's go look at that again.", 'start': 590.25, 'duration': 0.902}, {'end': 593.134, 'text': 'sorry, so position parent.', 'start': 591.152, 'duration': 1.982}, {'end': 598.782, 'text': "let's put the parent first.", 'start': 593.134, 'duration': 5.648}], 'summary': 'An attraction algorithm determines direction and movement towards closest leaf for segment addition.', 'duration': 73.182, 'max_score': 525.6, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY525600.jpg'}], 'start': 345.697, 'title': 'Creating and attracting branch objects', 'summary': 'Discusses creating branch objects for a tree, defining their properties and relationships, and implementing an attraction algorithm for branches to cause meandering of segments.', 'chapters': [{'end': 525.12, 'start': 345.697, 'title': 'Creating branch objects for a tree', 'summary': 'Discusses the creation of branch objects for a tree, including defining their properties and relationships, such as position and parent, and adding the root of the tree with a specific position and no parent.', 'duration': 179.423, 'highlights': ['Defining branch objects with position and parent The chapter explains the creation of branch objects with properties like position and parent, marking the significance of these attributes in defining the segment and its relationship within the tree.', 'Adding the root of the tree with specific properties The chapter emphasizes the creation of the root of the tree by defining its position, which is set at the middle of the canvas, and its parent as null, establishing it as a special case with no parent.']}, {'end': 629.274, 'start': 525.6, 'title': 'Attraction algorithm for branches', 'summary': 'Covers the implementation of an attraction algorithm for branches, where each branch is pulled towards the closest leaf, causing meandering of segments.', 'duration': 103.674, 'highlights': ['The branch needs to have a direction, which is also something that can be obtained from the constructor.', 'The next segment is added at the end and is pulled toward the closest leaf, causing meandering of segments.', 'The order of arguments for making a new branch needs adjustment, with the parent being placed first.']}], 'duration': 283.577, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY345697.jpg', 'highlights': ['The next segment is added at the end and is pulled toward the closest leaf, causing meandering of segments.', 'Defining branch objects with position and parent The chapter explains the creation of branch objects with properties like position and parent, marking the significance of these attributes in defining the segment and its relationship within the tree.', 'Adding the root of the tree with specific properties The chapter emphasizes the creation of the root of the tree by defining its position, which is set at the middle of the canvas, and its parent as null, establishing it as a special case with no parent.', 'The branch needs to have a direction, which is also something that can be obtained from the constructor.', 'The order of arguments for making a new branch needs adjustment, with the parent being placed first.']}, {'end': 1084.256, 'segs': [{'end': 697.419, 'src': 'embed', 'start': 629.334, 'weight': 0, 'content': [{'end': 636.216, 'text': "So one thing that I need to do is, there's a key piece of data in this algorithm.", 'start': 629.334, 'duration': 6.882}, {'end': 637.956, 'text': "There's a lot of pieces to this algorithm.", 'start': 636.236, 'duration': 1.72}, {'end': 643.658, 'text': 'But key piece of data are something called a minimum distance and a maximum distance.', 'start': 638.316, 'duration': 5.342}, {'end': 646.219, 'text': 'And if you read the paper, this will be described in the paper.', 'start': 643.698, 'duration': 2.521}, {'end': 653.101, 'text': "The idea here is that later you're going to see that I'm going to be looking at the leaves.", 'start': 648.059, 'duration': 5.042}, {'end': 655.533, 'text': "And I'm going to look at the leaves.", 'start': 654.087, 'duration': 1.446}, {'end': 665.637, 'text': "leaf's distance to various branches, various segments that are in the system and The leaf, for it to be relevant,", 'start': 658.192, 'duration': 7.445}, {'end': 668.739, 'text': 'has to be between that minimum and maximum distance.', 'start': 665.637, 'duration': 3.102}, {'end': 673.742, 'text': "if it's too far away from any branches, It doesn't play a role if it's too close to a branch.", 'start': 668.739, 'duration': 5.003}, {'end': 676.084, 'text': "It's actually been reached and it's done.", 'start': 673.963, 'duration': 2.121}, {'end': 680.847, 'text': 'So one thing that I need to do when I start, if I only have this single branch,', 'start': 676.084, 'duration': 4.763}, {'end': 685.851, 'text': 'I need to make sure that branch is at least within a maximum distance of one of the leaves.', 'start': 680.847, 'duration': 5.004}, {'end': 697.419, 'text': "so the first thing I want to do is Add this maximum distance variable And I'm just going to say like a big number for now and a minimum distance and a kind of a small number for now.", 'start': 685.851, 'duration': 11.568}], 'summary': 'Algorithm requires minimum and maximum distances for leaf relevance.', 'duration': 68.085, 'max_score': 629.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY629334.jpg'}, {'end': 848.164, 'src': 'embed', 'start': 813.805, 'weight': 3, 'content': [{'end': 817.988, 'text': "so it's just growing straight up until it reaches the leaves and starts to fan out.", 'start': 813.805, 'duration': 4.183}, {'end': 821.111, 'text': "so I start by assuming it's not close enough.", 'start': 817.988, 'duration': 3.123}, {'end': 828.737, 'text': 'But if the distance is less than max, distance found is true, and this while loop should stop.', 'start': 822.435, 'duration': 6.302}, {'end': 838.381, 'text': 'But if it is not found, then I need to make a new branch.', 'start': 832.018, 'duration': 6.363}, {'end': 841.682, 'text': 'And how do I make the new branch?', 'start': 839.941, 'duration': 1.741}, {'end': 844.803, 'text': 'I can actually take that root branch right?', 'start': 841.942, 'duration': 2.861}, {'end': 848.164, 'text': 'Remember a branch.', 'start': 845.003, 'duration': 3.161}], 'summary': 'Algorithm creates new branches if distance is not close enough, using root branch.', 'duration': 34.359, 'max_score': 813.805, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY813805.jpg'}, {'end': 907.264, 'src': 'embed', 'start': 879.116, 'weight': 5, 'content': [{'end': 886.242, 'text': 'So if I go to the branch, I could write a function, and this is kind of recursion here in a way.', 'start': 879.116, 'duration': 7.126}, {'end': 894.228, 'text': 'Next is a function where, what does it need to do? It needs to make a new branch.', 'start': 886.802, 'duration': 7.426}, {'end': 898.979, 'text': 'Next branch is a new branch.', 'start': 895.757, 'duration': 3.222}, {'end': 905.463, 'text': 'And where is that new branch? So first of all, the next branch is its parent, is this particular object.', 'start': 899.359, 'duration': 6.104}, {'end': 907.264, 'text': "That's its parent.", 'start': 906.383, 'duration': 0.881}], 'summary': 'Discussion on creating new branches and their parent objects.', 'duration': 28.148, 'max_score': 879.116, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY879116.jpg'}, {'end': 1024.101, 'src': 'embed', 'start': 996.056, 'weight': 4, 'content': [{'end': 999.178, 'text': 'So anytime I refer to branches, I need to say this.', 'start': 996.056, 'duration': 3.122}, {'end': 1006.403, 'text': 'Leaves is not defined in line 20, so I need to say this.leave and this.leave.', 'start': 1000.999, 'duration': 5.404}, {'end': 1014.414, 'text': 'Then cannot read pods of undefined in line 21.', 'start': 1006.423, 'duration': 7.991}, {'end': 1015.055, 'text': 'Whoops, back.', 'start': 1014.414, 'duration': 0.641}, {'end': 1018.437, 'text': 'I had forgot a little bit of code in the for loop there.', 'start': 1015.775, 'duration': 2.662}, {'end': 1020.138, 'text': "So let's take a run this again.", 'start': 1018.877, 'duration': 1.261}, {'end': 1024.101, 'text': "Okay, so I don't see anything here because I'm not actually drawing those branches.", 'start': 1020.158, 'duration': 3.943}], 'summary': 'Debugging code to fix issues with branches and leaves.', 'duration': 28.045, 'max_score': 996.056, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY996056.jpg'}], 'start': 629.334, 'title': 'Tree branch algorithm', 'summary': 'Discusses the importance of minimum and maximum distance in the algorithm, emphasizing the need for leaves to be within these distances from branches and the impact of these values on the system, as well as the process of checking and setting these distances. it also covers the process of growing tree branches using an algorithm that involves iterating through the branches, checking the distance, and creating new branches based on specific conditions.', 'chapters': [{'end': 757.939, 'start': 629.334, 'title': 'Algorithm minimum and maximum distance', 'summary': 'Discusses the importance of minimum and maximum distance in the algorithm, emphasizing the need for leaves to be within these distances from branches and the impact of these values on the system, as well as the process of checking and setting these distances.', 'duration': 128.605, 'highlights': ['The importance of minimum and maximum distance in the algorithm is emphasized, as leaves need to be within these distances from branches to play a role in the system.', 'The impact of the chosen values for minimum and maximum distance on the system is highlighted, indicating that these values can significantly affect the algorithm.', "The process of checking the distance between the root's position and any given leaf, and setting the maximum distance variable in the Tree constructor is explained."]}, {'end': 1084.256, 'start': 757.939, 'title': 'Algorithm for growing tree branches', 'summary': 'Discusses the process of growing tree branches using an algorithm that involves iterating through the branches, checking the distance, and creating new branches based on specific conditions.', 'duration': 326.317, 'highlights': ['The algorithm involves iterating through the branches to check the distance and determine if a new branch needs to be created, providing insight into the process of tree growth (relevance: 5)', 'The process includes handling errors, such as undefined variables and incorrect references, demonstrating the troubleshooting aspect of coding (relevance: 4)', 'The code involves functions for creating new branches and drawing them, emphasizing the practical implementation of the algorithm (relevance: 3)']}], 'duration': 454.922, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY629334.jpg', 'highlights': ['The importance of minimum and maximum distance in the algorithm is emphasized, as leaves need to be within these distances from branches to play a role in the system.', 'The impact of the chosen values for minimum and maximum distance on the system is highlighted, indicating that these values can significantly affect the algorithm.', "The process of checking the distance between the root's position and any given leaf, and setting the maximum distance variable in the Tree constructor is explained.", 'The algorithm involves iterating through the branches to check the distance and determine if a new branch needs to be created, providing insight into the process of tree growth.', 'The process includes handling errors, such as undefined variables and incorrect references, demonstrating the troubleshooting aspect of coding.', 'The code involves functions for creating new branches and drawing them, emphasizing the practical implementation of the algorithm.']}, {'end': 1607.171, 'segs': [{'end': 1122.51, 'src': 'embed', 'start': 1084.276, 'weight': 4, 'content': [{'end': 1097.622, 'text': "What I want to do is actually have the tree start, the root start from the bottom And let's actually also have the leaves get a random location,", 'start': 1084.276, 'duration': 13.346}, {'end': 1100.805, 'text': "that's about 100 pixels off of the bottom.", 'start': 1097.622, 'duration': 3.183}, {'end': 1109.573, 'text': 'So in this case, we should see the branches being attached to themselves up until they get within maximum distance.', 'start': 1102.226, 'duration': 7.347}, {'end': 1117.2, 'text': 'So, although maybe the first one is my maximum distance is so high.', 'start': 1112.656, 'duration': 4.544}, {'end': 1122.51, 'text': 'yeah, so that works.', 'start': 1120.529, 'duration': 1.981}], 'summary': 'Tree grows from bottom up, branches attach up to maximum distance of 100 pixels from bottom.', 'duration': 38.234, 'max_score': 1084.276, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1084276.jpg'}, {'end': 1207.621, 'src': 'embed', 'start': 1181.403, 'weight': 0, 'content': [{'end': 1185.626, 'text': 'okay. so let me come back over here and now what I want to do in the tree.', 'start': 1181.403, 'duration': 4.223}, {'end': 1193.432, 'text': "so this is all the stuff that's kind of happening just at the beginning, just to get the tree sort of set up,", 'start': 1185.626, 'duration': 7.806}, {'end': 1199.917, 'text': 'and now what I want to do is add a function called grow and the function called grow.', 'start': 1193.432, 'duration': 6.485}, {'end': 1204.72, 'text': 'I want to look at all of the leaves.', 'start': 1199.917, 'duration': 4.803}, {'end': 1207.621, 'text': "So we're going to go through every single leaf.", 'start': 1205.5, 'duration': 2.121}], 'summary': "Adding a 'grow' function to look at all leaves in the tree.", 'duration': 26.218, 'max_score': 1181.403, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1181403.jpg'}, {'end': 1389.01, 'src': 'embed', 'start': 1352.414, 'weight': 3, 'content': [{'end': 1353.835, 'text': "And we'll use that for something later.", 'start': 1352.414, 'duration': 1.421}, {'end': 1359.94, 'text': 'So the main thing I need to do here in this particular tree, in this particular part again.', 'start': 1354.275, 'duration': 5.665}, {'end': 1365.625, 'text': "okay, I'm looking for the closest branch, but if I happen to find a branch, that's too close.", 'start': 1359.94, 'duration': 5.685}, {'end': 1365.985, 'text': "I'm done.", 'start': 1365.625, 'duration': 0.36}, {'end': 1368.207, 'text': 'Leaf is reached, break.', 'start': 1366.606, 'duration': 1.601}, {'end': 1372.531, 'text': 'And I think I might have, when I was doing this earlier, I think this might be an indication of the bug.', 'start': 1369.028, 'duration': 3.503}, {'end': 1377.455, 'text': "There was a bug in my code previously and I think maybe this is where it was, but we'll find out.", 'start': 1373.852, 'duration': 3.603}, {'end': 1389.01, 'text': 'otherwise else if distance is greater than Max distance Then also forget about it.', 'start': 1379.824, 'duration': 9.186}], 'summary': 'Debugging a code to find the closest branch and fix a bug.', 'duration': 36.596, 'max_score': 1352.414, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1352414.jpg'}, {'end': 1536.657, 'src': 'embed', 'start': 1501.512, 'weight': 1, 'content': [{'end': 1506.767, 'text': 'OK. so here we go.', 'start': 1501.512, 'duration': 5.255}, {'end': 1509.928, 'text': 'so this is this whole entire algorithm.', 'start': 1506.767, 'duration': 3.161}, {'end': 1521.655, 'text': "for every single leaf, I'm looking for the branch that's closest to it, and it has to be between the minimum distance and the maximum distance.", 'start': 1509.928, 'duration': 11.727}, {'end': 1530.84, 'text': "so the question now becomes for every leaf, after we've looked through the all of the branches, what do we do?", 'start': 1521.655, 'duration': 9.185}, {'end': 1536.657, 'text': 'what do we do if Closest branch is not null?', 'start': 1530.84, 'duration': 5.817}], 'summary': 'Algorithm finds closest branch for each leaf within specified distances.', 'duration': 35.145, 'max_score': 1501.512, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1501512.jpg'}], 'start': 1084.276, 'title': 'Tree growth and algorithms', 'summary': 'Discusses tree growth from the root, adjusting branches, and shifting focus to leaves, along with an algorithm to find the closest branch for each leaf within a specified distance range, including bug identification and optimization suggestions.', 'chapters': [{'end': 1207.621, 'start': 1084.276, 'title': 'Tree growth and shifting focus', 'summary': "Discusses the process of growing a tree from the bottom, adjusting the branches' locations, and shifting focus from the root to the leaves, with a mention of the 'grow' function.", 'duration': 123.345, 'highlights': ['The process involves starting the tree from the bottom and adjusting the leaves to be around 100 pixels off the bottom.', 'The branches are attached to themselves up to a certain maximum distance, and the root extends until it reaches a certain number of pixels close to the branches.', "The focus shifts from working on the root to working on the leaves, with the introduction of the 'grow' function to iterate through every leaf."]}, {'end': 1607.171, 'start': 1208.222, 'title': 'Finding closest branch algorithm', 'summary': 'Describes an algorithm to find the closest branch for each leaf within a specified distance range, identifying potential bugs and suggesting improvements, and ultimately determining the closest branch for every leaf.', 'duration': 398.949, 'highlights': ['The algorithm iterates through each leaf and searches for the closest branch within a defined distance range. Iterating through each leaf and searching for the closest branch within a defined distance range is a key aspect of the algorithm.', 'Identification of potential bugs in the code and suggestions for improvement are discussed, such as the condition for checking the closest branch. Identification of potential bugs in the code, such as the condition for checking the closest branch, and suggestions for improvement are significant points in the transcript.', 'Determining the closest branch for every leaf based on specified conditions is the ultimate goal of the algorithm. Determining the closest branch for every leaf based on specified conditions is the ultimate goal and outcome of the algorithm.']}], 'duration': 522.895, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1084276.jpg', 'highlights': ["The focus shifts from working on the root to working on the leaves, with the introduction of the 'grow' function to iterate through every leaf.", 'Determining the closest branch for every leaf based on specified conditions is the ultimate goal and outcome of the algorithm.', 'The algorithm iterates through each leaf and searches for the closest branch within a defined distance range. Iterating through each leaf and searching for the closest branch within a defined distance range is a key aspect of the algorithm.', 'Identification of potential bugs in the code, such as the condition for checking the closest branch, and suggestions for improvement are significant points in the transcript.', 'The process involves starting the tree from the bottom and adjusting the leaves to be around 100 pixels off the bottom.', 'The branches are attached to themselves up to a certain maximum distance, and the root extends until it reaches a certain number of pixels close to the branches.']}, {'end': 2200.552, 'segs': [{'end': 1700.251, 'src': 'heatmap', 'start': 1648.226, 'weight': 0, 'content': [{'end': 1652.687, 'text': 'Essentially, I want to add a new segment, but I want this leaf to essentially attract it.', 'start': 1648.226, 'duration': 4.461}, {'end': 1655.308, 'text': 'I want it as if this leaf is pulling on the next segment.', 'start': 1652.727, 'duration': 2.581}, {'end': 1659.009, 'text': 'So instead of the next segment just going straight up, it goes this way.', 'start': 1655.528, 'duration': 3.481}, {'end': 1660.629, 'text': "It doesn't go directly to it.", 'start': 1659.189, 'duration': 1.44}, {'end': 1663.21, 'text': "This is like a force that's pulling it in that direction.", 'start': 1660.689, 'duration': 2.521}, {'end': 1666.512, 'text': 'Because here, if this continues, the next segment is going to pull even more.', 'start': 1663.59, 'duration': 2.922}, {'end': 1670.133, 'text': "And eventually, it's going to get so close that this leaf will then get deleted.", 'start': 1667.132, 'duration': 3.001}, {'end': 1673.155, 'text': "So that's why I'm going to get these nice, curvy, veiny-looking paths.", 'start': 1670.333, 'duration': 2.822}, {'end': 1681.139, 'text': 'So how do I pull it? A way of pulling it is normalizing it and then adding it to this particular direction and then putting that at the end here.', 'start': 1673.615, 'duration': 7.524}, {'end': 1682.84, 'text': "So let's look at how I might do that.", 'start': 1681.459, 'duration': 1.381}, {'end': 1693.779, 'text': 'So, here with closest branch, what I need to do is create a new direction which is subtracting.', 'start': 1683.12, 'duration': 10.659}, {'end': 1694.801, 'text': 'what am I subtracting??', 'start': 1693.779, 'duration': 1.022}, {'end': 1697.766, 'text': "I'm subtracting that particular leaf.", 'start': 1694.901, 'duration': 2.865}, {'end': 1700.251, 'text': "right. I'm on a particular leaf.", 'start': 1697.766, 'duration': 2.485}], 'summary': 'Describing the process of adding a new segment and using a force to pull it in a specific direction to avoid overlapping and achieve a curvy, veiny appearance.', 'duration': 44.723, 'max_score': 1648.226, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1648226.jpg'}, {'end': 2007.378, 'src': 'embed', 'start': 1977.31, 'weight': 3, 'content': [{'end': 1978.93, 'text': "So that's the first thing I can take care of.", 'start': 1977.31, 'duration': 1.62}, {'end': 1985.888, 'text': 'The next thing I can take care of is I need to go through all of the given branches.', 'start': 1979.49, 'duration': 6.398}, {'end': 1988.631, 'text': 'So now I need to look at every single branch.', 'start': 1986.649, 'duration': 1.982}, {'end': 1999.336, 'text': 'And I need to figure out what branches were attracted to what leaves.', 'start': 1991.755, 'duration': 7.581}, {'end': 2007.378, 'text': 'So how do I know if a branch was attracted to a leaf? Well, I know if its count was increased by at least one.', 'start': 2000.216, 'duration': 7.162}], 'summary': 'Identify and analyze branches attracted to leaves, ensuring a minimum count increase of one.', 'duration': 30.068, 'max_score': 1977.31, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1977310.jpg'}, {'end': 2065.831, 'src': 'embed', 'start': 2036.784, 'weight': 1, 'content': [{'end': 2040.545, 'text': 'so the first thing I need to do is I need to actually average.', 'start': 2036.784, 'duration': 3.761}, {'end': 2050.306, 'text': 'I need to divide by count, because I was adding all those vectors to it, and if it was near 10 different leaves, then I want to divide by 10.', 'start': 2040.545, 'duration': 9.761}, {'end': 2058.304, 'text': "so what I should do is take that branch, that branch's direction, and divide it by that branch's count.", 'start': 2050.306, 'duration': 7.998}, {'end': 2063.009, 'text': "So that's a way of averaging however many branches I was sort of attracted with a force.", 'start': 2058.684, 'duration': 4.325}, {'end': 2065.831, 'text': 'And then I want to make a new branch.', 'start': 2063.79, 'duration': 2.041}], 'summary': 'The speaker needs to average the vectors and divide by count, and then create a new branch.', 'duration': 29.047, 'max_score': 2036.784, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY2036784.jpg'}], 'start': 1607.451, 'title': 'Branch growth and interaction algorithms', 'summary': 'Covers methods for creating new branches or segments, an algorithm for branch and leaf interaction, and a branch growth algorithm. it discusses attracting segments, pulling branches towards leaves, and averaging branch directions. it includes details about deleting leaves too close to a branch and focuses on branches with counts greater than zero.', 'chapters': [{'end': 1673.155, 'start': 1607.451, 'title': 'Branch and segment attraction', 'summary': 'Discusses how to create new branches or segments based on the closest branch, by using a direction vector to attract the next segment, resulting in curvy, veiny-looking paths.', 'duration': 65.704, 'highlights': ['Creating a new segment by using the closest branch as a direction vector to attract it, resulting in curvy, veiny-looking paths', 'The next segment is influenced by the force of the closest leaf, leading to curvy paths', 'The goal is to have the next segment pulled in a specific direction by the closest leaf, creating attractive, curvy paths']}, {'end': 1977.31, 'start': 1673.615, 'title': 'Algorithm for branch and leaf interaction', 'summary': 'Explains an algorithm to interact branches and leaves, where branches are pulled towards the closest leaf by creating a new direction and normalizing its length to 1, then incrementing the count variable for the branch. the algorithm also involves deleting leaves that are too close to a branch.', 'duration': 303.695, 'highlights': ['The algorithm involves creating a new direction by subtracting the position of the closest branch from the position of the leaf, normalizing it to a length of 1, and then adding it to the direction of the existing branch.', 'Each branch needs to have a count variable that increments every time it is found near a particular leaf, which will be later used to average all the forces together.', 'The process also includes the deletion of leaves that are too close to a branch by looping through the leaf array backwards and deleting elements within the minimum distance.']}, {'end': 2200.552, 'start': 1977.31, 'title': 'Branch growth algorithm', 'summary': 'Discusses the process of branch growth, including the averaging of branch directions and the creation of new branches based on attraction to leaves, with a focus on branches with counts greater than zero.', 'duration': 223.242, 'highlights': ["The process involves averaging the branch's direction by dividing it by the branch's count, and then creating a new branch attached to the existing branch.", 'Branches with a count greater than zero are the focus, with the need to create new branches based on their attraction to leaves.', "The chapter emphasizes the importance of averaging the branch's direction by dividing it by the branch's count, and creating new branches attached to existing ones.", 'The algorithm involves checking branches attracted to leaves and creating new branches based on their attraction, with a specific focus on branches with counts greater than zero.']}], 'duration': 593.101, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY1607451.jpg', 'highlights': ['Creating a new segment by using the closest branch as a direction vector to attract it, resulting in curvy, veiny-looking paths', "The process involves averaging the branch's direction by dividing it by the branch's count, and then creating a new branch attached to the existing branch.", 'The algorithm involves creating a new direction by subtracting the position of the closest branch from the position of the leaf, normalizing it to a length of 1, and then adding it to the direction of the existing branch.', 'Branches with a count greater than zero are the focus, with the need to create new branches based on their attraction to leaves.']}, {'end': 2751.065, 'segs': [{'end': 2249.892, 'src': 'embed', 'start': 2221.313, 'weight': 1, 'content': [{'end': 2231.259, 'text': "I've got a reset I've got to reset the count and also actually the branch should have its original direction They shouldn't change so this is great.", 'start': 2221.313, 'duration': 9.946}, {'end': 2232.599, 'text': 'I forgot an important step.', 'start': 2231.279, 'duration': 1.32}, {'end': 2233.3, 'text': "no wonder It's.", 'start': 2232.599, 'duration': 0.701}, {'end': 2237.722, 'text': "I don't know if this is what's causing the problem, but I certainly didn't forget a really important step.", 'start': 2233.3, 'duration': 4.422}, {'end': 2243.285, 'text': 'so branches Have to be reset.', 'start': 2237.722, 'duration': 5.563}, {'end': 2249.892, 'text': 'so One thing I want to do is say original direction equals.', 'start': 2243.285, 'duration': 6.607}], 'summary': 'Branch reset needed for original direction. important step missed.', 'duration': 28.579, 'max_score': 2221.313, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY2221313.jpg'}, {'end': 2476.103, 'src': 'embed', 'start': 2433.2, 'weight': 0, 'content': [{'end': 2434.62, 'text': "it's actually running quite slow,", 'start': 2433.2, 'duration': 1.42}, {'end': 2445.704, 'text': 'And something I could do to kind of speed things along that makes more sense is also to To have the branches have kind of a minimum length, if my,', 'start': 2434.62, 'duration': 11.084}, {'end': 2450.386, 'text': "the length is based on the Direction vector, which I didn't actually normalize.", 'start': 2445.704, 'duration': 4.682}, {'end': 2460.22, 'text': "I just realized I think I I think there's technically some correct way of doing this that I probably missed.", 'start': 2450.546, 'duration': 9.674}, {'end': 2476.103, 'text': 'So if I go here, when I made the new direction, let me find, where is that? Oh, I already had this next function.', 'start': 2460.88, 'duration': 15.223}], 'summary': 'Improving performance by setting minimum branch length and normalizing direction vector.', 'duration': 42.903, 'max_score': 2433.2, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY2433200.jpg'}, {'end': 2682.126, 'src': 'embed', 'start': 2650.868, 'weight': 2, 'content': [{'end': 2653.23, 'text': 'So what types of patterns?', 'start': 2650.868, 'duration': 2.362}, {'end': 2655.771, 'text': 'leaf, veiny, tree-like patterns, even in 2D.', 'start': 2653.23, 'duration': 2.541}, {'end': 2656.612, 'text': 'how can you use color?', 'start': 2655.771, 'duration': 0.841}, {'end': 2658.373, 'text': 'How can you use thickness?', 'start': 2657.332, 'duration': 1.041}, {'end': 2661.275, 'text': 'The more branches that are layered in the same spot can you make it thicker?', 'start': 2658.433, 'duration': 2.842}, {'end': 2662.856, 'text': 'Try some of these ideas.', 'start': 2661.615, 'duration': 1.241}, {'end': 2663.777, 'text': 'Improve on this.', 'start': 2662.916, 'duration': 0.861}, {'end': 2669.501, 'text': "And I'll try to come back in another video and kind of make these improvements, because I think it would be good to do a follow-up on this.", 'start': 2664.117, 'duration': 5.384}, {'end': 2671.722, 'text': 'But let me just fix one thing.', 'start': 2670.441, 'duration': 1.281}, {'end': 2682.126, 'text': "I don't need to normalize the direction because I divided by count, but where did I divide by count?", 'start': 2673.743, 'duration': 8.383}], 'summary': 'Discussing the use of patterns, color, and thickness in designs, with plans for future improvements.', 'duration': 31.258, 'max_score': 2650.868, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY2650868.jpg'}], 'start': 2200.552, 'title': 'Debugging tree function', 'summary': 'Discusses debugging the tree function, including issues with resetting counts and original directions, improving branch growth speed, and encouraging viewers to experiment with different parameters and patterns for branch growth.', 'chapters': [{'end': 2751.065, 'start': 2200.552, 'title': 'Debugging tree function', 'summary': 'Discusses debugging the tree function, including issues with resetting counts and original directions, improving branch growth speed, and encouraging viewers to experiment with different parameters and patterns for branch growth.', 'duration': 550.513, 'highlights': ['Issues with resetting counts and original directions The speaker discusses the importance of resetting counts and original directions for each generation of branches to avoid potential problems in the tree function.', 'Improving branch growth speed The speaker identifies the need to improve branch growth speed by setting a default length for branches and utilizing the next function, resulting in faster branch growth.', 'Encouraging viewers to experiment with different parameters and patterns for branch growth The speaker encourages viewers to consider arranging seed leaves, adjusting minimum and maximum distances, and exploring color and thickness to create varied tree-like patterns and suggests potential improvements for the algorithm.']}], 'duration': 550.513, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/kKT0v3qhIQY/pics/kKT0v3qhIQY2200552.jpg', 'highlights': ['Improving branch growth speed The speaker identifies the need to improve branch growth speed by setting a default length for branches and utilizing the next function, resulting in faster branch growth.', 'Issues with resetting counts and original directions The speaker discusses the importance of resetting counts and original directions for each generation of branches to avoid potential problems in the tree function.', 'Encouraging viewers to experiment with different parameters and patterns for branch growth The speaker encourages viewers to consider arranging seed leaves, adjusting minimum and maximum distances, and exploring color and thickness to create varied tree-like patterns and suggests potential improvements for the algorithm.']}], 'highlights': ['The algorithm starts with a random sea of dots representing leaves and then creates segments that are attracted to the leaves, spawning branches as they approach.', 'The segments are attracted to the leaves almost like gravitational attraction, and as they get close to a leaf, they spawn another branch and may start to get attracted to another branch.', 'The discussion delves into the nitty gritty of how the algorithm works as the code for the branches, segments, and the tree is developed.', 'The first step is to write a constructor function for a tree, which includes an array of 100 leaves, each represented as a circle on the canvas.', 'The process involves creating a function for a leaf, where each leaf is assigned a random position on the canvas.', 'The chapter also explores the possibility of adjusting the quantity and placement patterns of the leaves to create different visual effects, such as placing 500 leaves on the canvas.', 'The next segment is added at the end and is pulled toward the closest leaf, causing meandering of segments.', 'Defining branch objects with position and parent The chapter explains the creation of branch objects with properties like position and parent, marking the significance of these attributes in defining the segment and its relationship within the tree.', 'Adding the root of the tree with specific properties The chapter emphasizes the creation of the root of the tree by defining its position, which is set at the middle of the canvas, and its parent as null, establishing it as a special case with no parent.', 'The importance of minimum and maximum distance in the algorithm is emphasized, as leaves need to be within these distances from branches to play a role in the system.', 'The impact of the chosen values for minimum and maximum distance on the system is highlighted, indicating that these values can significantly affect the algorithm.', "The process of checking the distance between the root's position and any given leaf, and setting the maximum distance variable in the Tree constructor is explained.", 'The algorithm involves iterating through the branches to check the distance and determine if a new branch needs to be created, providing insight into the process of tree growth.', 'The process includes handling errors, such as undefined variables and incorrect references, demonstrating the troubleshooting aspect of coding.', 'The code involves functions for creating new branches and drawing them, emphasizing the practical implementation of the algorithm.', "The focus shifts from working on the root to working on the leaves, with the introduction of the 'grow' function to iterate through every leaf.", 'Determining the closest branch for every leaf based on specified conditions is the ultimate goal and outcome of the algorithm.', 'The algorithm iterates through each leaf and searches for the closest branch within a defined distance range. Iterating through each leaf and searching for the closest branch within a defined distance range is a key aspect of the algorithm.', 'Identification of potential bugs in the code, such as the condition for checking the closest branch, and suggestions for improvement are significant points in the transcript.', 'The process involves starting the tree from the bottom and adjusting the leaves to be around 100 pixels off the bottom.', 'The branches are attached to themselves up to a certain maximum distance, and the root extends until it reaches a certain number of pixels close to the branches.', 'Creating a new segment by using the closest branch as a direction vector to attract it, resulting in curvy, veiny-looking paths', "The process involves averaging the branch's direction by dividing it by the branch's count, and then creating a new branch attached to the existing branch.", 'The algorithm involves creating a new direction by subtracting the position of the closest branch from the position of the leaf, normalizing it to a length of 1, and then adding it to the direction of the existing branch.', 'Branches with a count greater than zero are the focus, with the need to create new branches based on their attraction to leaves.', 'Improving branch growth speed The speaker identifies the need to improve branch growth speed by setting a default length for branches and utilizing the next function, resulting in faster branch growth.', 'Issues with resetting counts and original directions The speaker discusses the importance of resetting counts and original directions for each generation of branches to avoid potential problems in the tree function.', 'Encouraging viewers to experiment with different parameters and patterns for branch growth The speaker encourages viewers to consider arranging seed leaves, adjusting minimum and maximum distances, and exploring color and thickness to create varied tree-like patterns and suggests potential improvements for the algorithm.']}