- [Instructor] Welcome.
I have my exercise file open already.
This is the second video in two videos
focused on vector math.
In this video, I want to talk about dot product,
the second component in the vector math
tool set that's less intuitive.
So, let me grab that dot product and put it on here.
I have a vector here that I'm controlling
with these three sliders, so I have the X, Y, and Z
component of that vector.
So let's plug that vector into our dot product,
and I'm going to plug in the unit X.
Now let's see the calculation.
So, the dot product between the X vector,
or first, my custom vector in the X vector,
is exactly the same as the X component of that vector.
And that's always going to be true.
It's always going to be exactly the same.
And if I plug in the Y to my dot product,
now, that calculation matches the Y component
of my custom vector.
And that's because this dot product component is basically,
you can think of it as measuring
the extent of a vector along another vector.
So, it seems kind of trivial if I go back to vector
and then grab the deconstruct vector component,
I'm basically replicating exactly
what this component is doing,
if I look at the Y output next to the value
of my dot product output, they're exactly the same.
So, what's the point?
Well, this dot product component lets me calculate
that extent, or that length, that vector length
along any vector, so if I copy this,
and I have another custom vector and I use that,
now, I'm calculating the length of this first vector
along a second vector,
which can be any arbitrary vector,
so now, the measurement vector that I'm using,
I have total control over.
And I'm calculating the dot product of this first vector
along the direction of the second vector.
So, is this useful?
Well, one application for this dot product calculation
would be mapping geometry from
one coordinate system to another.
So, if you want to see an example of that,
if I create a surface, so I'll do rectangular plane,
and input that,
now, I'm creating a frame or a plane based on that surface.
And I have a box here.
So I'm going to take all the points of this box,
and I'm going to map it using this dot product calculation
from the world coordinate system
into a sort of inverted coordinate system
based on this plane.
So, let's see what that looks like.
So to visualize, I'm just going to create this curve,
which is based on the vertices of that box,
so we can recognize what's happening.
And then, grab my dot product component here.
And I'm treating these vertices as
vectors, because points and vectors
are really the same thing.
And I'm going to use my
plane that I'm creating from this surface
to calculate these dot products.
So, I'll go to vector.
Deconstruct plane.
And I'm going to use each axis.
So I'm saying, what is the extent
of the points generated from this box along the axes
of a plane based on the surface.
And then I'm going to rebuild those points.
So right now, this curve and this curve
are exactly the same, but if I grab this plane
and I start rotating it,
you can see that dot product is allowing me to actually
map the points from one plane into another plane.
But this isn't a perfect mapping, it's not like orient.
It's actually calculating the extent of those vectors
along vectors generated from this plane.