Why can't you multiply vectors?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right so math and cats enough said right love it first sight so just kidding Freya is an independent game developer and educator and today she's going to talk about a topic that to some is the stuff of nightmares and to others like myself is perhaps a little bit more the stuff of dreams and all the squiggly lines in between so in her talk she's going to hopefully inspire you all to consider the math underlying our games a little bit more magical thank [Applause] you okay hello everyone to probably the most technical talk uh going to teach you all about set theory and quorans um but so this talk is called uh why can't you multiply vectors um and so I've been doing a lot of things within game development and math for a long time now I started out doing just I started out as an environment artist and then moved into like level design and then I eventually learned programming and I got really excited about that and then I gotone into math like very heavily the past like two years or so um and now I've sort of like dived so deep into math that sometimes the stuff that I talk about game developers are like oh this just seems like useless abstract nonsense like why are you even doing this like I just want to make a game I just want to copy paste my from the internet and just like past it into my game so that it works I don't care about the underlying stuff um but today I want to talk about that underlying stuff anyway so you're going to have to suffer through that um so there's a bit of a Schism sometimes between math and programming so I sent uh this tweet at some point um on 911 of all day so this is my personal 911 because this started a war between programmers and math people uh which was really weird but like all the math people were like what are those for Loops that makes no sense like all of these symbols that looks so complicated and weird and then you had all of these programmers that were like but what are those weird symbols like there's no context for this there there's nothing describing what that does you just have to know what that does right um but so so all I really wanted to do was kind of like draw this like simple analogy for people who might not know that much math to just be like okay so these summation symbols is just adding things up in a for Loop and the capital um Capital Pi is just a product you're just multiplying things together um so that that was interesting because because it kind of illuminated to me that there's this big Schism and or like big divide that I kind of want to merge and I see that as sort of my job in a way of trying to bridge that Gap um little bit about me uh probably don't care that much I've co-founded a studio called NE Corp uh made a game called budget cuts and budget cuts 2 we were Studio like seven very awkward size um made some plugins for Unity uh one called Shader Forge and one called shapes uh one is a um Shader editor and the other one is a vector graphics plugin that I'm also working on a spline plugin right now that is not released yet uh I also make YouTube videos so I made some videos about tech Arts math uh and Tool development uh mostly within Unity um and then I've also made some YouTube videos about beia curves and splaines all right um so I'm a tech artist that's kind of the the center of what I do it's kind of the intersection of Art and programming and math kind of comes in there to do all of these kinds of weird funky techy visual solutions to problems in games um so a lot of the stuff I do is just like trying to work out things like how do you render lines in a way that looks nice because you know you have like a naive implementation might look like garbage but if you like spend some time thinking about it you can make something that looks much much prettier um and so a lot of the work I've been doing as of late has to do with splines this is an excerpt from my video um it's just just just a lot of splines I've just had splines in my head for like the past three years and I can't get them out and so here I am uh recently I've been getting into like quaternionic splines which is like splines in querian space to like interpolate orientations and some torsion visualizations I don't know I have a bunch of things related to that I do that's a doc aedr anyway so in this talk we're going to explore why can't you multiply vectors um and I think as with any other talk I think you should always start on the second slide with like some common criticisms of the title of the talk and so some common criticisms might be yes you can it's called a DOT product like what are you talking about uh or you might say well yes you can it's called a cross product like why why do you mean you can't multiply V vectors uh or you might say what do you mean I multiply vectors all the time uh this could be early signs that you might be a Shader programmer um and no you're actually not really multiplying vectors and you're going to find out why um so the anatomy of a vector just to go through what we're actually talking about um we usually write it in bold letters and that's a vector v it has three components if it's a 3D vector uh realizing I'm forgetting to breathe because this is I have so much to talk about um so we have three components uh X component the Y component and the Z component usually written in a parenthesis right and you can also write it as a column Matrix if you want to which can be useful sometimes because you can like write longer lines for each component kind of useful and this kind of presumes a basis as in the basis vectors of our coordinate system right we have an X axis we have a y y axis and a z-axis and they're all orthogonal to each other and they have a length of one so they're orthonormal is what we call it in the industry all right so products we we obviously know about the dot product everybody's heard about that and it's some kind of multiplication right you have your vector a your vector B and then you write little dot in between and then the dot product is basically multiplying each of the components and then adding them all up into a single scalar value so it's something called a scalar product can also write it using the summation notation so it's like Dimension independent so if you want to do the dot product in any Dimension you can use that formula uh I hope it's readable and not too small uh then we have the cross products the cross products does not return a scalar it returns a vector so the cross products we have this kind of complicated formula of just picking out very specific components for um each of the X Y and Z components of the final output Vector that's a cross products and then we have the 2D quote unquote cross products which is illegal don't tell your math teacher that you've been using a 2d cross product because doesn't really exist but it's a very useful thing in games to have and that's basically a cross product where you just set Z to zero and then whatever's left is your 2D cross product uh it's also sometimes known as the perpendicular dot product or the exterior product or the determinant or the wedge product or the anti-symmetric product it has many names I don't know why it's annoying and then finally we have the hadamard product which is the Shader programmer product where you just say well just just multiply the components like ju just do that like why not just take every component multiply them together that's your new Vector um so that's a component wise product okay so we have the dot product we have the cross product and we have the hadamar product but what about the product like just just smash them together no goddamn symbols in between just a canonical product right because usually you don't write anything in between if you if you want to write 5x you don't do like you don't have to write a symbol there in math you just like have no symbol because multiplication is kind of the canonical main operation right and so I think a lot of people me included a few years ago I was just like just do it component wise like why do you why are you overthinking this like if you multiply vector by a scalar like a vector like two * a vector a you just multiply each component by two right so that's component wise if you divide it by two that's also component wise uh if you add two vectors that's also component wise we add the x axis together we add the Y uh components together and the Z components together also component wise uh subtraction works exactly the same way so why would multiply not just be the hadamard product you just take each component and multiply them together right just just don't worry about it just just goam just just multiply all of your vectors and don't care about the rest it's going to be fine but it's not that simple unfortunately uh so I'm going to take you all back to elementary school we're going to talk about the natural numbers so the uh integers starting from zero and up so all of the positive integers and usually zero as well that's when you count things um so we're going to we're going to count uh snail cats so here's a snail cat um so let's say you have two snail cats and then you add three snail cats how many do we get we get five snail cats isn't that amazing um so two three and five are all natural numbers we can count items using natural numbers right um so let's let's try multiplying so two snail cats multiplied by three three snail cats is six snail cats great that's perfectly fine just one more um so we have two snail cats minus three snail cats and then we get well that's not actually a natural number anymore right like 2 minus three now we get something negative and that's not within the realm of natural numbers like negative negative is not a natural number right and so in a very technical sense in math we usually say that natural numbers are closed under addition and multiplication but it's not closed under subtraction because it's possible to leave the realm of natural numbers if you subtract right because 2 minus 3 not a natural number okay so we can talk about numbers of different kinds right natural numbers we can add them that it's closed under addition we get a natural number if we add two natural numbers same with multiplication uh but not subtraction because then we need the integers the integers uh they have these like technical symbols the Blackboard bold um so natural numbers are n integers are z uh for some German reasons I think I don't know what it is um so then we need integers and that includes the negative numbers right the negative integers okay so integers are closed uh right so subtraction of natural numbers gives you integers uh integers are closed under um addition multiplication and subtraction but not under division right because if you do 1 divided 3 that's not an integer we've again we've left the realm of integers and we've gotten into the realm of rational numbers so rational numbers is an integer divided by another integer so with division with natural numbers and integers uh we get a rational number um we can also do exponentiation so if you take like a natural number like 2 to the^ of three uh that is also a natural natural numb so we stay with the natural numbers there so it's also closed under exponentiation but integers are uh again if you do integers and you do powers on those so like uh 3 to the power of negative 1 would also give you a rational number all right rational numbers uh closed under addition multiplication subtraction division you get a rational number out of that you don't change the kind of number uh exponentiation gets a little bit more complicated um because you could do to the power of 0.5 which is a uh square root because 0.5 is just 1/ two as then we need the real numbers so the square root of five can't be expressed as an integer divided by an integer uh but the real numbers are closed under all of these four operations um but then we might want to go to the next step like what about exponentiation and here's where we enter complex numbers uh because now it's getting a little bit weird here because um that's just an entirely different type because a real number is just all the usual numbers we're familiar with but the complex numbers uh can express things like the square root of neg five um in real numbers we usually say that you just can't do the square root of a real number but with complex numbers we have a way to express that and complex numbers are algebraically um no sorry so complex numbers um how many of you know what complex numbers are raise your hand quite a few okay so I can sort of speedrun this this one okay so let's say we have a thing called I and if you square I you get1 um it's just an algebraic symbol it's a variable like any other but the only thing we know about it we don't know its contents or its value the only thing we know is that it squares to negative one in other words if you multiply it by itself we get negative 1 um and this is called the imaginary unit and this is just axiomatically true uh which is math speak for because I told you so it is true and we just have to accept that right okay so how do we do math with this well if we have 3 I * 2 I that would be 6 i^ 2 and since i^ 2 is1 this is equal uh because we can apply this rule of i^2 = 1 then this becomes -6 okay another example 2 I * 4 IUS 3 we just distribute that and then we get 88 i^ 2 - 6 I again i^ is1 so we get 8 - 6 I and we can sort of think of these numbers as having two parts to them the first part here is the real number this is just a regularized number that we use all the time and then we have a coefficient of I so this is called the imaginary part and you can kind of divide these up into these two separate categories and that's what's called complex number so that's when you have a a a regular number a real number and then some coefficient of I okay so let's say we have a complex number Z then we can interpret it similar to a vector because a vector also has two parts right if you have a a 2d Vector you have an X component and a y component um similarly we can write complex numbers the way we write vectors just in parentheses right where we have the real part and the imaginary part and now the basis is just the value one and I because that those are the things we multiply each of the components by in order to get the final uh result right so you can kind of see the similarity between complex numbers and vectors like they both have two components well for 2D vectors um and so you can define a coordinate space using vectors you have an x- axis and a y- AIS you can also just do the same with imaginary units so you can have a real axis for the real numbers and a vertical axis that's the imaginary axis and then for writing coordinates we just do exactly the same thing we do for vectors so for 2D vectors we have maybe this coordinate would be one and two so one on the x axis two on the y- axis uh can do the same for the uh complex number so this is called a complex plane um and it's just the same it's just one and two it's just that we're using a different basis the cool thing about complex numbers is that we can actually just write them as a formula like the way we did before just 1 + 2 I that's what this represents right um and so this is really useful what's useful about this one is that we can do Algebra with this we can if we have this formula we can just add them together or multiply them and just see what happens right and so if we wanted to find out like okay what happens when you multiply two vectors uh well if if complex numbers are vector likee we can figure out what happens when you multiply two complex numbers and maybe that's going to give us like some answers along the way for how to multiply vectors together so we can just try to work go through that process so like let's say we have two complex numbers a complex number A and B we multiply those together so we just write them out as equations um and as usual we just distribute uh or like expand the whole thing uh then we might notice that oh this part has two in it right so it's it's i s uh which means that it's equal to to NE 1 so we multiply that whole thing by ne1 and so now we can see that this part they share a common factor of I so we can factor that out and now we get a complex number in the end so we had two complex numbers we multiply them together just regular multiplying no dot products or cross products or anything we just multiply them together and in the end we get another complex number because we can express this as a coefficient of just a real number and a coefficient of I so so what we can say is again complex numbers are closed under multiplication because we give two complex numbers and we get a complex numbers out of it so if you want to implement this in code like this is how you would write that the the actual symbol of I is never in your code it's just completely not there the I is only there to like help us Define the algebraic operations that we do using this and and so we had our formula here right so we're we're calculating some sort of real part from two complex numbers and then we get the real part here and then we we calculate the imaginary part we get the imaginary part and then we'll return a complex number so we only ever store the coefficients we don't ever store like the the weird I symbol right um so the the reason we can do this is because it's closed under multiplication that's why it returns a complex number okay so so what does this look like because now if we interpret this as a vector we should be able to visualize this because it we can interpret complex numbers as 2D vectors and this is what it would look like so here we have two vectors the red one and the blue one and we multiply them as complex numbers in the complex plane and the green Vector is the result and you might be able to tell that it has something to do with like sort of adding the angles up right it's kind of like taking the angle of one of the vectors adding it to the other angle and when it's normalized you can see that the vectors have the same length like the green one doesn't get longer or shorter than the red one or the blue one and so so this one is while it's not a vector multiplication it's still complex number multiplication we might be able to apply some of the same strategies for figuring out like what happens when you multiply vectors okay so now we figured out that complex numbers are closed under multiplication and in fact they are closed under all of these operations uh and it's the only I think it's called a complete algebra uh I think it's actually the only complete algebra within math which I think is kind of cool um that it's closed under all of these operations all right but what we really want to figure out is vectors right like that was the the whole point of this talk like why can't we multiply vectors like it should be possible I I really want to try to do it you know so if we go back to this we could write our complex numbers as a real part plus a an imaginary part times I so why can't we do that with vectors we have an X component we multiply it by a symbol representing our x-axis and then we add the Y component multiplied by a symbol representing the y axis and so now if we use this again we can do Algebra with this right like now we can actually just do it ourselves instead of just listening to our math teacher or me you can just like actually do it yourself right so now we have another way of writing vectors in other words like this if we have a 3D Vector we just take each of the components and multiply multiply them by the symbol representing each of the three basis vectors of our coordinate system okay so if we have two vectors A and B These are 3D vectors uh we can write them like this so these again we have the components we have the axes and then we can do some algebra with this so let's do something simp like multiplying a scalar by a vector just a number times a vector well we have a number s we multiply that by our vector and we that just distributes to all the terms um in there and we can see that that's a componentwise uh multiplication which is what we would expect right because it we've been told that that's component wise and it seems to be right all right let's try one more so addition so we want to add these two vectors together and we can remove the parentheses because they're useless uh and then we can find some common common factors here there's a common factor of the X AIS again the Red X is just referring to the abstract concept of the x- axis and so we just factor out uh those axes and we end up with this and now again we have a clean like factor of XY and Z separately and so we can say we can say that addition is component wise which is what we were told before too so I guess they were right so that's component wise fine and if we do this with all of these operations we can find both addition and subtraction is component wise but we haven't multiplied two separate vectors yet right we've want on a scalar times a vector but not a vector times a vector and so what's that going to be like are we going to stay within the realm of 3D vectors like kind of like the cross product the cross product you know has us stay in there right or maybe we we're kind of like the dot product where we just get a real number out of it instead of a vector right okay so let's let's find out we have the tools right we we can just have our two vectors A and B multiplying them together no goddamn symbols in between just a pure multiplication we write it out that's this is the equation we just have to solve for right like a straight up multiplication uh there's a lot of terms here because you need to multiply these together and you get this which is ax BX XX which is a little bit abstract we don't quite know what that is yet um and then we just keep on doing this and we end up with a lot of terms uh and so there we go uh there we have it so so this is what happens when you multiply two vectors I guess um but now we have a little bit of a problem like because like this is not a vector anymore like we can't write this as a factor of X plus a factor of Y plus a factor of Z like this is just a pile of nonsense right um and so we can see that vectors are just not closed under multiplication we don't get a vector out of this it seems uh and so uh that's why you can't multiply vectors and so thanks for coming to my talk hope hope this was useful so obviously that doesn't feel enough right like okay we found out that it was it had this weird solution but like but but what is it like I I need to find out like like we have to solve this we haven't Sol it yet like what it obviously gave us some sort of algebraic structure and we need to investigate this and actually like code this whole thing because there has to be answers in there right like I'm willing to go to the ends of the Earth to just like approach this whole problem and just figure out everything and maybe we need to take a little bit of a leap of faith As a treat and so we're going to ask an oracle a Divine being of incomprehensible wisdom oh great Oracle salad his name is salad um we made a feeble attempt at multiplying vectors and we seem have reached an impass can you illuminate us the Divine being contemplates for a second and says I see a tricky conundrum indeed but fear not the answers you seek are closer than you think don't worry you are safe now my child I bestow upon you a key to understanding Venture forth and the answers you seek will be revealed to you now I must nap leave me be and the Divine being turns into a nonukan manifold okay so this is some sort of divine axiomatic truth we were given so what does this say so it's a vector it's in bold so if you multiply a vector by itself in other words Square it you get the length squared like the length of that Vector multiplied by itself but this is not the full answer right this is just what happens when you multiply a vector by itself but we want to know what happens when you multiply two arbitrary vectors okay but let's experiment with this so let's say we have a vector with the values 1 two and three and we want to square this in other words multiply it by itself according to our divine axium um it is the length squared and the length we can just use the Pythagorean theorem right that's we've learned that in school and then we square that uh the square root and the square cancel out and so we're left with 1 s plus 2 squ plus 3 squ and we get 14 okay so if we square a vector we get just a real number and in this case it's 14 okay so let's explore this some more so what about our basis vectors because we have an xaxis A y- axis and a z- axis they all have a length of one right so what happens when you multiply those two together well following our Axiom that should be equal to the length squared which is just one squar right and so that's just one so if you take our xaxis and multiply it by the x- axis we get one out of that and all of a sudden we actually have gotten one key to the solution here because those all of these terms that are crossed out they just evaluate to one so those three terms are just multiplied by one right okay so now we've like started to unravel this a little bit so now we we can like separate out those terms we have like a like that's just a real number because those are no longer multiplied by a vector right all right but we still have a bit of a mess on the lower part like what the heck is YZ and XZ and YX like that that's still nonsense to us right there's actually one more thing that our divine axiomatic rule gives us so if you consider the basis vectors again mutually orthogonal they have a length of one y yada if you consider the diagonal between X and Y just x + y gives you this white vector right and we know that the length of that one is a square root of two because we we can use the Pythagorean theorem for that right um and so then we can actually make use of our axium to find out some more about this because we can plug in the length that is the square root of two so if we take our Vector the white Vector is just x + y and we square that we should get something that is the sare root of 2^ squ so the left hand side we can expand the right hand side we can just cancel out the square root and so we get the expanded form of XX + x y + YX + y y and that's equal to 2 all right but we know that x * X is 1 and y * Y is 1 right we already figured that out so now we have this we can subtract two from both sides so we end up with x y + YX equal Z and if we subtract YX from both sides we get this and this might seem kind of innocent like okay sure like we have XY equals y X so the components are swapped and negated but it means that they're equal so we can swap components at will because if they're basis vectors then we can do this okay so going back to our equation here we can see that in the top one we have YZ on the first term but then we have z y on the other one so what we can do is that we can swap these two terms and then negate that term because we we now have this rule of X yal YX so we swap them and now we have subtraction symbols there instead of addition and then we can Factor those out do any of you recognize these do do these formulas seem familiar like some something seems to have kind of jumped out at us right like this is the dot product and we never set out to define the dot product we just followed the Divine command we were given of like the square of a vector is the magnitude squared and somehow we got the dott product out of it as a complete like side effect and this is the cross product the cross product somehow also jumped out of us so we just somehow invented both the dot product and the cross product without ever intending to do so we just wanted to know what happens when you multiply two vectors right and so everything stems from this one rule uh but we still have a mystery of like what the heck are these anyway like YZ ZX XY are just kind of confusing constructs we we know nothing about them right so let's explore those a little further and see what happens with those so for example maybe we can try seeing what happens if you square them we take xy^ squ that equals xyxy and we know that we can swap two of these and negate and that's going to be the same thing so if we swap the middle two components we get Negative XX y y we know what XX is we know what y y is right so we get -1 * 1 so we know that that's equal to1 so we have a thing that we can square that gives us a negative one that's the imaginary unit we didn't set out to invent the imaginary unit either this is all just still stemming from that one axiomatic Rule and this actually applies to the other combinations as well of ZX and YZ um and so if you match them together like this that will all all that equals 1 and you might have seen this in a different form before so i^2 = J2 = k^2 = i j K1 is the definition of querian that's the the way quorans are defined right now and so what seems to have happened is that when we multiply two vectors together two 3D vectors together we we get a querian which is written with an H for Hamilton um and so that's kind of weird isn't it um and so so this thing that we have here has a basis of one YZ ZX and XY and that has the exact algebraic behavior of querian and each component obviously it's a factor of each of these so you can there it's a multiple of each of those bases and so that's our cians and so what about 2D like we haven't looked at 2D vectors now so we should try 2D as well um that's just setting Z to zero and if we multiply two 2D vectors together we get this and this has a basis of one and XY which that's the complex numbers that still just has the same algebraic Behavior as complex numbers but so this is fascinating and kind of weird that we just like went through this algebraic journey and somehow like multiplying vectors gives us querian and complex numbers um but again like what what are these things like what is YZ and ZX and XY and like we still don't know like we we kind of want to find that out too so if we consider the basis vectors of a coordinate system our XY Axis or in 3D our XYZ axes they are they all have a length of one and they're all mutually orth so that's our BAS vectors the things we're trying to figure out now are these like YZ and ZX and all of that right and these look suspiciously similar to the cross product don't they and the cross product has this behavior of if you have two vectors A and B and you do the cross product you get something that's perpendicular to both of them in other words it's normal to the plane formed by those two vectors and it also just so happens that the magnitude the length of this green Vector is the area formed by the parallelogram between those two vectors uh both in 2D and in 3D and so maybe this has something to do with planes rather than like points in space right all right so if we have our um our XY component that's that's the only one we have in 2D that was the one that was equal to the imaginary unit and in 3D we have YZ ZX and XY so what if we conceptualize these these these bases as planes so so maybe our our XY is refer refers to the plane formed by X and Y and specifically the unit plane like a plane with an area of one and if we extend this to 3D there's obviously three planes now that are the the basis planes of our coordinate system and so maybe we can call these bases by vectors so that's what that's what we're going to name these they're not quite vectors but they're sort of like two vectors forming a plane you know so let's call them B vectors they have an area of one and they are mutually orthogonal and so the way to think about this is that if you have a regular Vector like a point in space um then it's kind of like casting a shadow onto each of the axes right the the three components of a vector is just how far along each axis is this point and so for by vectors it's the same thing but instead of points along axes maybe we can interpret this as an oriented area casting Shadows on each of those three basis bi vectors the three basis planes and so a bi Vector has those three numbers it looks very similar to a vector if you just look at those numbers right um but we interpret it as a bi Vector so it's an oriented plane with an area and and that's it it has no position or anything like that and if we manipulate it you can see that the the numbers change as well so this is just me turning it around in unity um and so so again we get kind of the Shadow on each of those three uh planes and it can be negative so we can we get a signed area on each of those three those three planes uh and obviously it has an area so we can we can scale it up as well it can be larger it can be smaller and so forth um and so so those so this is what a b Vector would look like if you just write it in code you have like just three components it looks awfully similar to Vector but algebraically it's entirely different because the basis is YZ ZX and XY it's not XYZ and in fact these B vectors they represent represent the minimum information required in any given Dimension to store both a plane and a magnitude and and this is why uh it shows up quite a lot when dealing with rotation rotations because rotations happen in a PL right like they don't really happen around an axis like if you have rotations in 2D there's no third axis to speak of but there is a plane you can rotate in right um and so um if we look back at the cross product the cross product again gave us a vector so it has an X Y and Z uh component just a regular Vector but the thing about the cross product is that in math and physics we talk about something called a pseudo Vector uh which is it has like these weird transformation rules like if you mirror the result of a cross product it doesn't have the like expected behavior um and it only works in 3D and 7D um don't ask me why it's just the way it is um and it has all these hidden transformation rules the thing we were doing now where uh we returned a b Vector instead is called a wedge product and usually you write it with this little hat thing um and so it algebraically it's exact the same in terms of the coefficients but the bases we use are completely different because we have YZ ZX and XY instead so this returns a b Vector it generalizes to any Dimension it doesn't have to be only 3D and 7D or whatever and it's a that's a little harder to understand though because like we were never really taught about B vectors in school right or at least I wasn't but um and so so here we have the the the 3D and the 2D Vector multiplication we can write it a little bit more generalized by saying that multiplying two vectors together is the dot product plus the wedge product uh of those two vectors together because the wedge product gives us the bi Vector part of that multiplication uh let's see does this work oh it works hell yeah I thought internet wouldn't work and another place where this actually shows up that I ran into uh is in when talk is when talking about a thing called curvature um so here you can see something called the oscul Circle um so this is kind of the circle that matches the curvature of this spline that it's moving along um and the radius of that is one divided by the curvature um so if if instead of thinking about the radius you think about the inverse of the radius and that's curvature so a curvature of zero is a straight line a curvature of One turns in One Direction a curvature of negative one turns in the other direction uh anyway it's a useful Concepts um and so if we want to measure curvature of a parametric function say this is how you would do curvature in 2D this is just like straight up from Wikipedia if you want to see how to measure curvature uh this is a scalar and it can be it's signed in other words it can be both negative and positive um and then we have curvature in 3D and here we have the magnitude of the cross product between the velocity and the acceleration divided by the speed cubed um and so so so these are like these look very different if you're not familiar with everything that we just talked about um but like this one is always positive because we're getting the magnitude of a vector so all of a sudden it's no longer signed there's no like negative curvature or positive curvature and what about the axis like if curvature turns kind of around an axis in 3D right and so these two that's looking a little sus like now we we can kind of recognize these patterns right and so this is just a wedge product so we've kind of been mistaken and thinking about the curvature and thinking of them as like either scalar or the cross product or the magnitude of the cross product but if we just do the wedge product instead that is just much more simple and it generalizes to any Dimension again um and so instead of returning just a scalar or a vector we get a B Vector out of that um yes I'm going to go a little bit over time are you all okay with that okay I'm almost done um so so this is kind of a generalized curvature anyway so so what I think is cool about this is that throughout math we've had this thing of like like mental gymnastics of like you can't really multiply vectors but but here's eight different products just use those instead and and also the cross product doesn't work at all in all Dimension but it works in 3D and like 5D or or 7D maybe like one of those one of those and also cross product returns a pseudo Vector with like special transformation rules so it's not really a vector and and call complex numbers they're like 2D vectors but also not at all but they can like rotate and and cians are like an extension of complex numbers with the rules i squal j squal kkal ne1 it's just like Jesus Christ right or we can just say that if you if you square a vector you get the length squared that seems a little bit more simple and then everything else all of those things we talked about just naturally emerge from that definition what we've been talking about is called geometric algebra more specifically it's a Clifford algebra uh and if you take all these components and like combine them into a big multi Vector in 2D that will look like this we have a a scalar we have or a real number we have a vector and a bi vector vector has two components B Vector only has one component that's a full 2D VGA multiv Vector so VGA is either vanilla geometric algebra or vector geometric algebra people haven't agreed on this uh then the 3D mul Vector looks like this so the vector has three components now and the bi Vector also has three components and this is why we probably mixed up vectors pseudo vectors together because like they both have three components in 3D uh but it's actually much better to express the result of the cross product as a b Vector instead there's also a thing called a tri Vector which is the the unit volume formed by the three basis vectors um we're not going to get into that and so so basically all of these Concepts that we've kind of like juggled around with all these special rules they can actually generalize in a really clean way using this this framework right uh and so instead of like separating like complex numbers and querian as like separate things we can just call them rotors and that's a real number plus a b Vector of that given Dimension and so finally after this whole journey you might be wondering like well if multiplying two 3D vectors gives us a querian and in games we use querian for rotations what rotation does that represent like what happens when we do that um and this is what it represents so we're multiplying these two vectors together and the orientation that we get we're orienting this Cube based on it is twice the angle between those two vectors in the plane formed by those two vectors and so that applies to 3D as well so if we like separate these two vectors out you can see that the cube rotates after that and it's like twice the angle between those two um if you want to read read up more on that look up Quan's a double cover that talks about why it's twice the angle uh and so so why why couldn't you multiply vectors well probably because your teacher didn't explain geometric algebra to you right um but now you can and and that's that's my talk thank thank you very much for [Applause] coming all right thank you so much so if anything your talk was both a question and an answer to the multiplication of cast mats and rainbow so there's that you have produced at least an answer to that very tricky multiplication and with that I would love to open it up for a couple of questions has any yeah this is a really weird Cube that they pass around it's very strange uh I probably should have mentioned that there was going to be questions at the end and now I forgot what are you exploring next while people think of questions sorry what what area are you exploring next that you want to break your brain over I'm still stuck in querian so I'm in I've been like I've been making like a spline Library um where like a spline library for Unity that has like quaternionic splines um and I want to like Implement a bunch of different types of spines in quitan space which is really fascinating and weird and so that's been kind of a recent Obsession yes is it working yeah all right oh there we go first of all I want to say I love the talk uh that you've been given and also your YouTube channel that uh oh can you talk a little closer I can yeah um that I I really like your YouTube channel and the talk that you've just being oh thank you um uh what type of what different type of problems could uh do you have that could help with where you would have uh a benefit for using um uh the wedge factor or the these operations in what other types so most of it is useless like if you like this whole talk waste of time um but it's like again this is kind of more like reframing things you already knew like if you looked up how querian worked or how complex numbers worked they would just be separate systems kind of but now they're kind of unified in a way that makes more sense like like for example one thing that like I think a lot of people if you want to implement querian most people even engine developers probably just like copy some code paste it into their engine and then call it a day and now you have cernium for rotations right uh but one thing that I learned after like reading up on how they actually work is like you can learn all sorts of like tricks with them so for example I I had a use case of um I wanted I wanted to like interpolate and uh I don't know which coordin system we should use use I want to interpolate an orientation along a spline and then I wanted to add a feature of reversing that spline so this should turn 180° in order to reverse that whole spline um and when I did the math for that like you did you know that like reversing equan is a swizzle you just Shuffle the components like you can just and in any of these three axes or the world space axis it's literally just shuffling the components it's a free operation in terms of like computational power you don't have to do a full like 180° angle axis multiplication right and stuff like that is like all of these little like mathematical tricks that kind of pop out um but if you if you don't really care that much about that you don't have to learn all of this it's just a useful framework to me at least and also if you want to make a game in any other dimension than 2D or 3D this is also very useful then you really need this all right any any other questions questions people are really hungry I'm sorry I kept you all this long uh oh over there you get a cube thank you and does your uh math Library support geometric algebra um so yeah I do have a math library on GitHub I have some geometric algebra components it's not like fully fleshed out so I I've only been adding things there as I need them I haven't like made it into a library that has literally everything but I do have a library on my GitHub with like um like there's a bi Vector 3 Type there um and there's a like rotor 3 Type which is just a querian right um but I I do have that in my math Library yeah so if you do want to look into the code of like how this might look uh my website is up there uh these states there are too many social medias so just just everything's there just go there and then you can find all of the links to that thanks oh actually I don't think I have a link to my GitHub there that's the only link I don't have on my website you can probably find it if you Google I think all right any other questions and also you can if if you have other questions like later you can just come up to me and and talk to me that makes me feel important and happy that I could provide value to all of you uh so please validate my feelings by talking to me later hi uh I was just wondering do you still plan to uh do like your tools on other engines too like for on realen engine for example your spline upcoming tool I've considered it uh like obviously with all of the unity disaster um I've considered it and I looked into gdau and I looked into unreal but they're just they're very different tools like unreal is like it's a level designer and level artist tool that turned into a game engine and gdau is like it's just Engineers making a engine for engineers and it's very engineer uh and I feel it's not very artist focused and then anytime I try to do something that I do in unity of like making like quick editor scripts and just like have that really fast iteration that is just destroyed and unreal in gdau I think it's a bit more balanced because they have like a more like easy to use like scripting language and whatnot uh but I don't know like if I like I make like 70% of my income is from selling pluggins in unity um and so like could I really support that in gdau which is like very like open source free software driven and I'm like I don't know I think that Community is not like quite like big enough yet to like support something like the tools that I do and so like if anything I might like transition to doing like Standalone tools just separate exes that you open rather than like tying it to any specific engine um or I'm just going to go back to making games again uh because yeah I kind of kind of want to do that but yeah yep uh all right I I think we got sign that we should cut yes a stoic nod of like all right thank you all so much for coming or did you want to close out or no we're good no okay okay all right thank you all time for lunch
Info
Channel: Freya Holmér
Views: 405,053
Rating: undefined out of 5
Keywords: Acegikmo, Freya Holmér, Freya, Holmér, mathematics, Vectors, Multiplying vectors, Geometric Algebra, Clifford Algebra, Multivectors, Dutch Game Day, math, Multivector
Id: htYh-Tq7ZBI
Channel Id: undefined
Length: 51min 15sec (3075 seconds)
Published: Thu Oct 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.