1.1 What is a Vector? - The Nature of Code
Vložit
- čas přidán 5. 08. 2024
- Welcome to Nature of Code Chapter 1: Vectors! What is a vector? How do they work in p5.js? These questions will all be answered in this first section of this series on p5.Vector. Code: thecodingtrain.com/tracks/the...
🚀 Watch this video ad-free on Nebula nebula.tv/videos/the-coding-t...
🕹️ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/s...
🎥 Previous video: • How to Graph Perlin No...
🎥 Next video: • 1.2 Vector Math - The ...
🎥 All videos: • The Nature of Code
References:
🔗 The Nature of Code Vectors: natureofcode.com/book/chapter...
Videos:
🎥 Coding Challenge 52 - Random Walker: • Random Walker in p5.js...
🎥 Classes in JavaScript with ES6: • 6.2: Classes in JavaSc...
Timestamps:
0:00 Welcome to Chapter 1!
1:08 Scalars have magnitude
2:09 Vectors have magnitude and direction
3:40 Thinking of (x,y) as a vector
9:03 createVector()
9:34 Add vectors to the random walker code
11:35 Create a Walker object
14:00 Next up: start adding the foundation for a physics engine
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: thecodingtrain.com/discord
✪ Nebula: go.nebula.tv/codingtrain
💖 Membership: czcams.com/users/thecodingtrainjoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#forbeginners #javascript #p5js
I admire your enthusiasm, Daniel. You are a great educator.
esse ai e BR
@@globinhoFF ola colega.
Totally agree!
Grammarly is helpful after all innit :uganda:
I am so glad you are taking time to remake these series Dan. Thank you!
This is fascinating. I was never interested in physics when I was a kid but this is so exciting, you're a great teacher, Daniel!
No matter how much I study vectors, understanding the what and why is always welcome
I've just bought your book The Nature of Code and I am planning to eat it from cover to cover while I am taking Computational Mathematics and Programming 2 at university. Thank you man you are the best!
I'm Glad you still make these vídeos, they're super helpful, thats a real teacher for you
I am just so happy you exist, for so many reasons!!
Thank you for the knowledge you are sharing and the enthusiasm you are spreading. ❤️
The definitive series to start learning computer graphics. Wish I had classes like these before!
You are the reason why I am passionate about coding. I hope I can be as passionate as you are... Keep up the good work.
i have been learning from you for quite some time , what i love is when you are talking about some topic and along the way you seem to have videos about a closely related topic . and when i am watching that video you have another video about another closely related topic .
All your videos are fun to watch.
Thanks for making them. I learn a lot from them.
I always go back to your intro videos because I love your explanations. Thank you!
This is Bob Ross of the 21st century but a techie instead
LMAO that's PERFECT!!!!!!
"Look there are some happy little vectors."
Love the explanation. Very clear.
When I was younger I found it helpful to conceptualize vectors AS an actual point, but with math functions to extract the information about direction, magnitude, distance, etc
Because when I was trying to take my algebra knowledge of a vector and apply it to programming, it ended up looking like:
struct Vec2d {
float magnitude;
float direction;
};
But luckily my mentor at the time set me straight quickly.
But since I was learning the concepts of OOP and encapsulation, the idea of a Point having encapsulated behaviors for distance, direction, etc just made more sense naturally.
Maybe a useful insight for any teachers of younger people.
Edit: Kate Gregory has a great talk about this at one of her CPPCon keynotes. People naturally understand objects-teach objectly
I've been using Processing and 5js for almost a year and I can't even explain how good a teacher you are, if only you did all computing topics such Software engineering and data science. You'd make university a breeze for 90% of students!
Yes, but i would argue that most professors, if they had a lot of freetime (e.g. as a youtuber), would be equally as good at teaching. stress is a big factor.
@@user-zu6ts5fb6g True, however someone reading from a slideshow he made 4 years ago isn't really worth paying £9000/yr for lol.
That being said, I do have some great tutors aswell!!
Could you do like a data structures course ? Btw I love your channel and your work.
just gotta love your enthusiasm for teaching
Your video helps me understand not only programming, but also expand my knowledge of the English language!)))) Amazing! Thank you much from Russia!
Your energy is a whole other level.
Thanks for the introduction to and explanation of vectors. 👍 Back in school I didn't understand it 😵, but through your video I finally could. 😁
wowww very interesting! waiting for the next video!!
You are the best teacher, ever!, Congratulations!
I don't know why I came to this video.. But it was really interesting to know the concept in depth.. I don't even know javascript yet but stayed till the end of the video ♥️ Literally never enjoyed a coding video this much♥️♥️💯
loving the way you teach
Happy to hear this series is being redone ! Love your channel Dan
Just want to let you know that you are an awesome teacher.
Dude... that swaeter is just amazing
You are so happy teaching us
This is the ideal math teacher that every one need.
Watching your video while experiencing detention. Love your video. Nail your style. Need theory and code
u deserve a lot more attention.
Gawd Dan I love you! ❤❤
Best teacher ever
Looking forward to future videos
Very intuitive explanation, thanks
learning in quarantine with the best teacher ever
math class always was boring for me but you made it fun
WOW! great video!
💕 Many thanks for your great job 💕
Dude makes the world a better place : )
That was extremely helpful lesson. Thanks for all of your work!
whenever i see that bubble class my mind goes to "what does it mean to be a bubble?!" :))) anyways, thank you so much for all the fun classes. i think i watched everything you posted on p5 and now i'm having a rewatch :D
Thanks dan to make the book free to read. it makes math less scarier to learn.
I'm from Italy and I just bought your book "The nature of Code". I hope to follow this playlist, cause i'm studying Computer Science for Software development in Italy, so I'm so interested... You are a great educator!!!
You're from Italy? aRe u in quarantine right now?
@@leo848 i live in a region where quarantine has not yet been arranged. But I'm avoiding leaving home so I'm quiet ... I spend time programming and netflix hahaha
Thank you.
Joder Danny es el mejor, Saludos Hermano.
Excellent 👌
It’s important to note that lists of numbers and arrows in space are BOTH vectors, neither are more fundamental than the other. A vector is really a super abstract idea, they are any set of objects which satisfy a certain collection of properties. It just so happens that arrows in space and lists of numbers both satisfy the necessary properties to be called a vector, and so they are both the same thing.
Ya still got it homie!!
you teach so damn good!!!! ty
Hoş geldiniz hocam.
love it, I want to be like you one day!!!!!
Thanks, really intresting (:
This is so great. Looking forward seeing this whole serie
love it
*this dot* song. I missed it so much ♥️
The way you teach us is funny, amazing and mesmerizing. The explanation you give is just awesome. And thanks for the free to read book. It really helps. ♥️
Coding Train == ❤️
You finally redid all the videos Dan. Hopefully we'll get to hear the "I'll magically edit these videos afterwards" statement. 😃
Very nice. Was doing pretty much the same thing as @11:00 couple of days ago, would been perfect to see this video then hehe.
I wanted to rand movement using vector in C++ and took the same approach as you did here but turned out it had to be a bit different(Couldn't solve it without looking it up :/ ).
pos.x=2*(float)rand()/(float)RAND_MAX -1;
And same for y.
U r awesome maaaaan
Always a pleasure to watch your explanations. A lot of value. top. thanks for your work!
Please, have some love from Germany
Will there be a chapter about state machines? I missed that in your old Book
Using vectors and drawing from your random walk and particle system examples, I have an idea for another code example. Simulate the spread of a virus, including options for the effect of lockdown. I quite like the idea of the reducing the alpha value as the walker ages.
Is there a way to save our creations as svg files for editing in graphics packages?
Who would dislike this?
😮
Please explain your video indexing scheme. I see this one, for example, begins with 1.1. All your videos are numbered, yet for the life of me, I can't make sense of this. Please point me to or make a video on what we are to make of this and how it's relevant to your content. Thank you very much.
Well, not Daniel, but:
Usually, teaching series like this one has the form: X.Y.Z. Where X is the chapter (like Vectors on this one), Y is the video inside this chapter (like introduction, summing, subtracting, rotating, etc.) and Z stands for the video part (when it has more than one part, like first we do basic things, then we improve, add colors, etc.)
Coding Challenges are "spare" videos on specific topics, started trying to code stuff with given time and then evolved to doing interesting things. The Coding Challenges are just sequential numbered #123 and sometimes it has two or more parts (thus #123.1 and #123.2)
Correct me anyone if I am also misunderstood x)
You can also check the navigation at thecodingtrain.com/ which hopefully will help a bit.
Not sure but aren't the 2 versions of the program not the same? If you use random adds to x and y then your new positions will be square relative to the origin. So +3 to both x and y will get you a 45 degree angle with a length of ~4.2. Whereas with actual vectors a 45 degree angle with a length of 3 will be a length of 3.
12:15 this dot song
Why did you use this.pos instead of pos in the attributes?
Hi dan🌈 do a video about finding the index of item in an array that the sum of its left side equals to the sum of its right side 🦄
What about glenz vectors?
You said we are going to be creating a simple physics engine. Are you going to be going over the Separating Axis Theorem?
how do I use processing with the atom text editor?
He's using p5js, the javascript version of processing, and running it on a webpage.
If you want to use processing I found a way to use it as a java library on stack overflow(stackoverflow.com/questions/21309851/use-processing-in-java-application). Then you can just use atom to editor your java project and run it using command line.
Yess! I hope I can make my girlfriend learn JavaScript through P5, keep at it!
Here's the thing that I don't understand; if the magnitude is the "hypotenuse", then it would seem that the magnitude of a vector is intrinsically tied to the x and y position. There would be no way to increase the length, or magnitude, of the vector without also changing the x and y components. Is there something that I'm misunderstanding?
I think he meant that you can move the vector without affecting the magnitude. For x and y component you need to substract the final X to the inital X (the same for y) values, so that you can move your vector and keep its magnitude. hope it will make sense.
dat fav scalar tho
Sir maybe the co ordinates would be (3,4)
How can i send a file i made to Dan?
*Physics vectors are important for game dev because velocity is how game objects move.
*P5 Vectors store X and Y components rather than direction and magnitude.
*var varName = createVector(xComponent, yComponent) to create vector obj
2:38 Ok I'm ggonna watch the rest of the video with my mom
ill take whatever he is taking ;D
okay but how many dimensionals did Dan record before getting cut off at 2:34 😂
sir, thank you for this amazing video but I wish more procassing videos so pelace do it
he did the same thing in Processing years ago. see here czcams.com/users/shiffmanplaylists?view=50&sort=dd&shelf_id=6 most helpful and enjoyable lessons i've ever seen :)
he's redoing this in p5 js now, so probably there's not many processing videos in the near future ;)
return this.inspired
== TRUE
this.dot this.dot this.dot the this.dot song!!! yay!!
You're only explaining the very basics about vectors. A second video about vectors would be great.
This is only the first episode. I'm sure he'll go over dot product and cross priduct
10:38 puts head down in defeat because i know im not going to do that :c
Shout out to everyone who watched the Processing originals.
Hi from Germany
This came at such a good time for me.
Int main()
{
String You = "gem"
return
What's our vector, Victor?
Hey Coding Train !! That you make it’s so very interesting, but I am a French People and... I don’t understand that you speak . In your other video, I see that subtitles on your other video . Can you put too on this video of nature of Code please for people French like me . Thank you very much I’m sorry if my English is bad or not
Merci! je vais essayer!
The Coding Train ok Thank you very much 😊
That 1 dislike😤
why you look more handsome than before haha
Right?! No homo, but I love that sweater! And that beard!
The fact I predicted he'd write 6
Please, add italian sub 😭
amo ne
There’s gotta be one guy that gets Dans IP address and measure the distance between them
This dot 🤣🤣🤣