Okay, here. We are again. This is exciting
I don't know how you live your life and what you've been looking forward to but I for one have been looking forward to this get past some of these
introductory videos, we're here,
I feel a little more comfortable you feel a little more comfortable
We are getting ready to talk about the building block. The building block of all of the examples that
we're going to look through it after this entire video series. We're going to look at physics simulation
Steering behaviors
fractals, genetic algorithms, all sorts of stuff. We need something to start with and the topic that is sort of the build,
the foundation for everything we're going to build on is vectors, so I want this video to
really just answer one single, two single questions,
a pair of questions if you will : what is a vector ?
And the second question really is why do we even care? Why if we are people who live our lives ?
Live our lives walking around and sitting down and doing stuff and eating food and then sometimes getting at a computer and programming graphics
Why should we care about a vector?
So the first question, what is a vector?
I'm supposed to answer that question okay, so um yeah
This is not the easiest question to answer. First of all it has a lot of
It's kind of hard. It's complicated, but you know let's simplify it for ourselves
Let's talk about a vector in two-dimensional space for a moment
I know that we don't live in two-dimensional space, but we program a lot in two-dimensional space and we also have two-dimensional space
this is kind of a
two-dimensional space right here. I'm doing weird things to the whiteboard
Hello
Anyway, so I just forgot to start the timer, but so I don't know how long I've been going with oh, it's been a minute
But we're gonna get to this question I feel awkward about it because I don't want to give the wrong answer. Let's just try.
let's try together um okay, so
What is a vector ? Okay, let's draw a vector for a second?
We can represent a vector in two-dimensional space as an arrow (it could actually represent into three-dimensional space as an arrow as well)
But let's look at this this is our vector. Let's think about this more
a little more substance of detail
A vector is something that has
magnitude
a key concept here and two
Direction
with an exclamation point to emphasize that point. A vector has both magnitude and direction. Now looking at this arrow,
I think this stuff might be so long. I think you want to figure this out already. What is the magnitude?
What is the magnitude of this vector ? The magnitude of this vector (we can say the length of it or the size)
This is the magnitude of a vector : is it a long arrow ? Is it a short arrow ? What is the direction?
Also perhaps a somewhat obvious
question the direction of this vector is the direction that it's pointing in, right ? An arrow points in a particular direction
We could formalize that, right ? We sort of
formalized magnitude by saying the length like I could get out a ruler and measure it and that's actually the magnitude of that vector.
We could say the direction is perhaps an angle relative to some axis, like if we think of having an x axis,
a horizontal axis, a line here, the direction could be represented by an angle, and I'm going to use the Greek letter theta (knocking noise)
Somebody's knocking at the door, it looks enough it eventually (door noise)
Okay (singing)
Okay, we cut scene back and we're back
Sorry for the little interruption there
So let's think about vectors for a moment in a slightly different way
Let's say you were giving directions to somebody from how to get from point a to point b. You might say :
Look you're looking to leave this place that you're in and run away, and escape. It's not very far. The door takes five steps forward
Let's say four steps forward because it's not that far
One two three four turn 90 degrees to the right and take three steps
Goodbye one, two three well
I could draw that out of the board as
one two three four steps, turn to the right, and one two three. Now if we look at this
I started in point A and I ended up in point B,
and here is my vector. This arrow describes how I get from point A to point B
And this is on, I keep looking at it, gotta turn it off because I would like to look at you it this is just
just us here this strange I
Don't know place that we are [okay] um so this vector has
Four steps over here and three steps over here it turns out by the way. What does this look like to you?
It looks like a right triangle with a right angle [you] might remember this thing called the pythagorean theorem a squared plus B
Squared equals C squared [the] 3 4 5 triangle the length of this arrow is actually 5 we're starting to see something here
Even though a vector conceptually is just this idea of an arrow it has a length
And it has a way that it's pointing
the magnitude in the Direction
We also start to see here thing there seems to be some type [of] math
Related to this that has to do with things we learned in geometry and trigonometry and we can make an angle here
We start saying sine of the angle is opposite over
Hypotenuse and cosine is well adjacent over hypotenuse. Hopefully I got that right
What's going on? Here? Well a vector can actually be separated into its components
The x component and the y component we can see that over here here is the x component?
That length and this length here is the y component?
so even though a vector K is expressed as an arrow length and magnitude it can also be expressed as a
pair [of] numbers and x and a y
Now you might be that might sound familiar to you right when was the last time you wrote a processing sketch
Where you didn't just stick at the very top of your program?
float x
float y, and
This is the moment where we have now answered our second question
Why do we care about vectors because we do this all [the] time we have x and y for position?
We've Xp and wisely for velocity maybe we have x acceleration y acceleration x wind y wind?
x
Friction y friction
x blast [y] blast either you could come up with any variable [its] x y this x y this and then when you go into
[3-2] your x y & z and x speed and y is beans these mean you're just this pile and pile
Variables, but you can't get control over and you're doing the same stuff with them over and over again a simple thing you do with
Them over and over again is x equals x plus
Xp y equals y plus y speed?
Right, but then when y speed changes by gravity and then when x p changes by wind you just have all of this stuff happening
over and over again and
There might be there's lots of mathematical functions that this is what I've just said this three times
This is why we might this is why with we can [rig]?
Very almost like prideful little the very first way of understanding why we care about vectors
It's just to say I don't want [to] have this in my code
I want to say instead of float x y I want to say P vector
position
now p vector is a class in processing that makes an object which is a vector and
We're going to get into [that]
I think I think this video it just needs to end and we'll move on to the next one you [can] just watch them continuously
But in the next video, we're going to get into the code more more deeply
So let's actually just go before we go to the next video walk. I don't
Walk over here to this blank space because this computer would sleep I [know] magic
Okay, so look at this. This [is] the bit of the
pristine example of exactly what I'm talking about we have a
Processing sketch where this ball moving around the screen. [oh] come on seriously computer
Well, you can imagine little boo doo doo doo the ball bouncing around the screen. This is so sad soul there we go
Okay, um where?
Where this processing sketch has an x to the y for position and x being and y speed for?
Essentially what we're going to start calling velocity the velocity vector of this object of the shape that's moving around the screen
So what I would like to do for us your give you as an exercise before you move on to [the] next video is go
And find a processing sketch sketch sketch. It's like a skit and a sketch
Can you make a prosthetic skip like program a skit that [would] be kind of interesting would [it] be entertaining to watch. I don't know
Find a sketch that you've made that
Were you model motion somewhere?
Where you have x's and y's and x b's and y's needs go and find that sketch because in the next video
We're going to look at how we actually
instead of just having x and y everywhere how we start using the [p] vector class describe the position of an [object] and the
Way that position changes over time, so that's what we're going to do in the next sketch. I'm going to dominat
I'm going to walk through [this] particular example, then you if you you'll have found yours
Then you'll try to add p vector into your sketch
And then hopefully we will figure out some way that we can communicate to each other and you could ask me some questions
and I could answer some questions because
You are not a person you are just the strange lens staring at me in this creepy strange way. I must stop this video now
Okay, so I [think] this is good for now
Thank you for watching I really appreciate it
If you're still watching I'm kind of shocked and amazed actually
But hopefully you're learning something if you're not you could just email me a complaint. I would that would be fine
I will accept all complaints okay. I'm going to there's a button after press over here to stop it. Okay. Goodbye