Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 09-02-2003, 08:15 PM
TribulationStaff TribulationStaff is offline
Registered User
Join Date: Jul 2003
Location: Pennsylvania
Posts: 368
TribulationStaff is on a distinguished road
Send a message via AIM to TribulationStaff
Scalar multiplication of vectors:

When you multiply a vector by a scalar, the direction of the vector is unchanged; only the magnitude changes. Let A=<a,b> and c be some real number. Then c*A=<a*c,b*c>.

Q: Why doesn't the direction change?
A: Think of it this way, if you have been in algebra, you should know that the slope of a line is the rise(change in y) divided by the run (change in x). Well, that is just what b and a are, respectively. So the slope of that vector is the direction of that vector. When you multiply both a and b by c, nothing changes in the slope, because c "cancels out" in the division.

Addition of vectors:

Q: How do you add/subtract vectors?
A: It is easy, once in Cartesian coordinates. Let A=<a,b> and B=<c,d>. Then A+B=<a+c,b+d>. If you wanted to subtract B instead of add it, you could just multiply it by -1, as above, then add just like you would normally.

The Scalar Product (The Dot Product)

Given two vectors, A and B, the scalar product of the two, in mathematical terms is written A·B=|A|*|B|*cos(theta), where theta is acute (or 180) angle between them. What does || mean, though? Well || returns the magnitude of the vector, making a scalar quantity. Since the dot product only involves the magnitudes of vectors, the dot prodect itself is a scalar quantity, hence the name scalar product. Using a previous example, speed is the magnitude of velocity.

Q: How do you find the magnitude of a vector?
A: Let v=<a,b>. Then, |v|=sqrt(a^2+b^2). For those with a good memory, you might recognize that to be just like the formula for finding r from Cartesian coordinates. That is because r is the magnitude of the vector.

Q: What if you don't know the angle between them?
A: That is one of the uses of the dot product. There is a shortcut way of figuring out the answer of the dot product itself. Let A=<a,b> and B=<c,d>. Then, A·B=a*c+b*d. And you already know how to find the magnitude of A and B. So just divide both sides by those magnitudes, and you are left with (A·B)/(|A|*|B|)=cos(theta). With the help of a calculator, you can find that angle.

Next post: Vector product (cross product)
__________________


Help me keep scripting

Last edited by TribulationStaff; 09-03-2003 at 06:54 AM..
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.