Fall2006.CSCI299Vectors History

Hide minor edits - Show changes to output

Changed lines 234-244 from:
to

!!!Follow the Leader

You have two objects
, ob1 and ob2 moving in space, and you wish to ob2 to follow ob1.

1) Easier set ob2.velocity to ob1.velocity - instantenous turn

2) smooth turn - get angle diff between ob1
.vel and ob2.vel. get cross product of ob1.vel and ob2.vel. set ob2.vel to rotate (ob2.vel, min(angle_diff, maxTurningCapacity), crossProduct)
to:
To bounce an object off a plane, get a vector perpendicular to the plane (see cross product above). Use this vector, v, as the axis to rotate the velocity vector of the object 180 degrees.

(:source lang=Python tabwidth=3 -trim :)
velocity = vector(3,4,5)
# velocity of object
perVector = vector
(-1,0,0) # vector perpendicular to plane y,z

newVelocity = rotate(v1, pi, v2
)

print newVelocity # outputs (3, -4, -5)
(:sourcend:)
Changed lines 164-174 from:
v1 = vector(3,4,5)
v2 = vector(5,6,7)

dotProduct = dot(norm(v1), norm(
v2))
print dotProduct
# outputs 0.998... (i.e., the cosine of their angle)

print cos(v1.diff_angle(v2)) # outputs 0.998... (yeap!)

print acos(dotProduct) # outputs 0.066... (i.e., the angle in radians)

print v1.diff_angle(v2) # outputs 0.066... (the same
)
to:
v1 = vector(2,0,0) # vector coincides with x axis
v2 = vector(0,2,0) # vector coincides with y axis

print cross(v1,v2)
# outputs (0, 0, 4) (vector coincides with z axis)
Changed lines 170-175 from:

This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1
.diff_angle(vector2)@@
to:
The cross product of two vectors corresponds to the area of the parallelogram they form. This can be used to calculate the areas and volumes of artifacts.
Changed lines 174-181 from:
diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
to:
To '''rotate''' a vector v1 around a vector v2 for a given angle use @@rotate(v1, angle, v2)@@.
Changed lines 177-184 from:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag
(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector
(2,3,4)

print s.pos
# outputs (4, 6, 8)
print mag(s.pos)
# outputs 10.77..., (spaceship has moved!)
to:
v1 = vector(1,0,0) # vector coincides with x axis
v2 = vector
(0,0,1) # vector coincides with z axis

# rotate v1 across the z axis 90 degrees
v3 = rotate
(v1, pi/2, v2)

# rotate v1 across the z axis 180 degrees
v4 = rotate(v1, pi, v2)


print v3
# outputs (6.12303e-017, 1, 0), approx. (0, 1, 0)

print v4 # outputs (-1, 1.22461e-016, 0), approx. (-1, 0, 0
)
Changed lines 191-194 from:
!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.
to:
!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the
'''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
Added lines 198-212:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)

!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.

(:source lang=Python tabwidth=3 -trim :)
Deleted lines 156-157:
Using '''normalized vectors''':
Changed lines 161-175 from:
@@cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
to:
The '''cross product''' of two vectors, v1 and v2, is given by @@cross(v1, v2)@@. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from v1 toward v2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of v1 and v2, times the sine of the angle between the two vectors.
Changed lines 164-171 from:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos)
# outputs 5.38... (distance of spaceship from origin)

s
.pos = s.pos + vector(2,3,4)

print s.pos
# outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
to:
v1 = vector(3,4,5)
v2 = vector(5,6,7)

dotProduct = dot(norm(v1), norm(v2))
print dotProduct
# outputs 0.998... (i.e., the cosine of their angle)

print cos(v1.diff_angle(v2))
# outputs 0.998... (yeap!)

print acos(dotProduct
) # outputs 0.066... (i.e., the angle in radians)

print v1.diff_angle(v2) # outputs 0.066... (the same
)
Changed lines 177-180 from:
!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case,
the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.
to:
This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find
the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an
object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
Added lines 194-208:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)

!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.

(:source lang=Python tabwidth=3 -trim :)
Changed lines 124-125 from:
The '''dot product''' of two vectors, v1 and v2, is given by @@dot(v1, v1)@@. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.
to:
The '''dot product''' of two vectors, v1 and v2, is given by @@dot(v1, v2)@@. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.
Changed lines 139-140 from:
If the two vectors are normalized, the dot product gives the cosine of the angle between the vectors. That's another way to get the angle between the two vectors.
to:
If the two vectors are normalized, the dot product gives the cosine of the angle between the vectors. That's another way to get the angle between the two vectors (i.e., use @@acos(dotProduct)@@).
Added lines 157-177:
Using '''normalized vectors''':

If the dot product is 0, the two vectors are at 90. If the dot product is positive, the angle between the vectors is less than 90. If its negative, the angle is greater than 90.

Using '''normalized''' vectors, if the dot product is 1, the vectors are parallel and in the same direction. If the dot product is -1, the normalized vectors are parallel but in the opposite direction.

@@cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
Changed lines 179-187 from:
v1 = vector(3,4,5)
v2 = vector(2,0,0)




print dot(norm(v1), norm(v2)) # outputs 0
.998... (i.e., the cosine of their angle)

print cos(v1.diff_angle(v2))
# outputs 0.998
to:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s
.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
Changed lines 189-209 from:

This may be useful in visualizing data represented by vectors.
It may also be used to calculate the area associated with the two vectors.

For applications see http://www
.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml

@@cross( vector1, vector2 )@@ calculates
the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin
.
to:
!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case,
the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.
Deleted lines 193-207:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)

!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.

(:source lang=Python tabwidth=3 -trim :)
Changed lines 249-250 from:
to:
# Alan Buzbee, [[http://www.studentsofgamedesign.com/vectors.php | Vectors]], Students of Game Design.
Added line 144:
Deleted line 145:
Changed lines 148-153 from:
print acos(dotProduct) # outputs 0.066... (i.e., the angle between the vectors in radians)

print v1.diff_angle(v2)
# outputs 0.066...

print cos(v1.diff_angle(v2))
# outputs 0.998...
to:
print cos(v1.diff_angle(v2)) # outputs 0.998... (yeap!)

print acos(dotProduct)
# outputs 0.066... (i.e., the angle in radians)

print v1.diff_angle(v2)
# outputs 0.066... (the same)
Deleted lines 125-126:
If the two vectors are normalized, the dot product gives the cosine of the angle between the vectors. That's another way to get the angle between the two vectors.
Deleted line 126:
Changed lines 137-157 from:
A nice property of the dot product is that if you multiply one of the vectors by the cosine of the angle (the one that you got by dividing the dot product by the lengths), you get the projection of the other vector onto that vector.

This may be useful in visualizing data represented by
vectors. It may also be used to calculate the area associated with the two vectors.

For applications see http://www.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml

@@cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin
.
to:
If you take the dot product of two normalized vectors, you can get the angle between the vectors using acos(dotProduct).

If the two vectors are normalized,
the dot product gives the cosine of the angle between the vectors. That's another way to get the angle between the two vectors.
Changed lines 142-149 from:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos)
# outputs 5.38... (distance of spaceship from origin)

s
.pos = s.pos + vector(2,3,4)

print s.pos
# outputs (4, 6, 8)
print mag(s
.pos) # outputs 10.77..., (spaceship has moved!)
to:
v1 = vector(3,4,5)
v2 = vector(5,6,7)
dotProduct = dot(norm(v1), norm(v2))

print dotProduct
# outputs 0.998... (i.e., the cosine of their angle)

print acos(dotProduct)
# outputs 0.066... (i.e., the angle between the vectors in radians)

print v1
.diff_angle(v2) # outputs 0.066...

print cos(v1.diff_angle(v2
)) # outputs 0.998...
Changed lines 156-159 from:
!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity'''
of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.
to:
A nice property of the dot product is that if you multiply one of the vectors by the cosine of the angle, you get the projection of the other vector onto that vector.
Changed lines 159-175 from:
s.pos = vector(2,3,4) # location of spaceship in 3D space
s
.velocity = vector(-5,2,1) # velocity of spaceship
s.speed = mag(s.velocity) # speed of spaceship (displacement per unit time)
s.direction = norm(s.velocity) # direction of spaceship

print mag(s.pos) # outputs 5.38..., spaceship's distance from origin

s.pos = s.pos + s.speed * s.direction # move spaceship at this speed and direction

print s.pos # outputs (-3, 5, 5)... spaceship has moved!
print mag(s.pos) # outputs 7.68..., spaceship's new distance from origin

# But s.speed * s.direction == s.velocity, since mag(v)*norm(v) == v, thus...
s.pos = s.pos + s.velocity # ... has the same effect

print s.pos # outputs (-8, 7, 6)... spaceship has moved!
print mag(s.pos) # outputs 12.20..., spaceship's new distance from origin
to:
v1 = vector(3,4,5)
v2 = vector(2,0,0)




print dot(norm(v1), norm(v2))
# outputs 0.998... (i.e., the cosine of their angle)

print cos(v1
.diff_angle(v2)) # outputs 0.998
Added lines 170-225:


This may be useful in visualizing data represented by vectors. It may also be used to calculate the area associated with the two vectors.

For applications see http://www.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml

@@cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.

(:source lang=Python tabwidth=3 -trim :)
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)

!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.

(:source lang=Python tabwidth=3 -trim :)
s.pos = vector(2,3,4) # location of spaceship in 3D space
s.velocity = vector(-5,2,1) # velocity of spaceship
s.speed = mag(s.velocity) # speed of spaceship (displacement per unit time)
s.direction = norm(s.velocity) # direction of spaceship

print mag(s.pos) # outputs 5.38..., spaceship's distance from origin

s.pos = s.pos + s.speed * s.direction # move spaceship at this speed and direction

print s.pos # outputs (-3, 5, 5)... spaceship has moved!
print mag(s.pos) # outputs 7.68..., spaceship's new distance from origin

# But s.speed * s.direction == s.velocity, since mag(v)*norm(v) == v, thus...
s.pos = s.pos + s.velocity # ... has the same effect

print s.pos # outputs (-8, 7, 6)... spaceship has moved!
print mag(s.pos) # outputs 12.20..., spaceship's new distance from origin
(:sourcend:)
Changed lines 102-108 from:
Given two vectors, v1 and v2, @@v1.diff_angle(v2)@@ returns the angle between them (in radians).

The following conversion formulas might come in handy:

@@radians = degrees * pi/180@@ \\
@@degrees = radians * 180/pi@@
to:
The '''angle''' between two vectors, v1 and v2, is given by @@v1.diff_angle(v2)@@ (in radians).
Changed lines 119-127 from:

ir
'''dot product'''. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.


Given two vectors,
v1 and v2, @@dot(v1, v1)@@ calculates their '''dot product'''. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.

If the two vectors are normalized, the dot product gives precisely
the cosine of the angle between the vectors. That's another way to get the angle between the two vectors.
to:
'''Note:''' The following conversion formulas might come in handy:

@@radians = degrees * pi/180@@ \\
@@degrees = radians * 180/pi@@

The '''dot product'''
of two vectors, v1 and v2, is given by @@dot(v1, v1)@@. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.

If
the two vectors are normalized, the dot product gives the cosine of the angle between the vectors. That's another way to get the angle between the two vectors.
Changed lines 129-137 from:
v = vector(1,1,1)

print v
# outputs (1, 1, 1)

print v
.mag # outputs 1.7320508075688772, which is the same as sqrt(3)

v.mag = 5 # set magnitude of v to 5

print v # outputs (2
.88675, 2.88675, 2.88675)
to:

v1
= vector(3,4,5)
v2 = vector(5,6,7)

print dot(v1,v2)
# outputs 74.0

dotProduct = mag(v1)*mag(v2)*cos(v1.diff_angle(v2))

print dotProduct
# also outputs 74.0
Deleted line 139:
Changed lines 114-115 from:
print radians # outputs 1.5707963267948966 (pi/2), i.e., 90 degrees)
to:
print radians # outputs 1.5707963267948966 (i.e., pi/2 radians == 90 degrees)
Changed line 121 from:
print v1.diff_angle(v3) # outputs 3.1415926535897931 (pi, i.e., 180 degrees)
to:
print v1.diff_angle(v3) # outputs 3.1415926535897931 (i.e., pi radians == 180 degrees)
Changed lines 102-103 from:
Given two vectors, v1 and v2, @@v1.diff_angle(v2)@@ calculates the angle between the two vectors (in radians).
to:
Given two vectors, v1 and v2, @@v1.diff_angle(v2)@@ returns the angle between them (in radians).

The following conversion formulas might come in handy:

@@radians = degrees * pi/180@@ \\
@@degrees = radians * 180/pi@@
Changed lines 110-117 from:
v1 = vector(1,0,0) # vector coincides with x axis
v2 =
vector(0,1,0) # vector coincides with y axis (vertical to v1)

print v1.diff_angle(v2) # outputs 1.5707963267948966 (pi/2), i.e., 90 degrees)

v3 = vector(-1,0,0)
# vector coincides with negative x axis (opposite of v1)

print v1.diff_angle(v3)
# outputs 3.1415926535897931 (pi, i.e., 180 degrees)
to:
v1 = vector(1,0,0) # vector coincides with x axis
v2 =
vector(0,1,0) # vector coincides with y axis (vertical to v1)

radians = v1.diff_angle(v2)
print radians # outputs 1.5707963267948966 (pi/2), i.e., 90 degrees)

degrees = radians * 180/pi # convert to degrees
print degrees # outputs 90.0

v3 = vector(-1,0,0) # vector coincides with negative x axis (opposite of v1)

print v1.diff_angle(v3)
# outputs 3.1415926535897931 (pi, i.e., 180 degrees)
Added lines 124-125:
Changed lines 100-122 from:
!!!Dot Product, Cross Product

Given
two vectors, v1 and v2, @@dot(v1, v1)@@ calculates their '''dot product'''. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors. If the two vectors are normalized, the dot product gives precisely the cosine of the angle between the vectors.

This may be useful in visualizing data represented by vectors. It may also be used to calculate the area associated with the two vectors.

For applications see http://www.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml

@@cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
to:
!!!Products and Angles

Given
two vectors, v1 and v2, @@v1.diff_angle(v2)@@ calculates the angle between the two vectors (in radians).
Changed lines 105-112 from:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos)
# outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4
)

print s.pos # outputs (4, 6, 8)
print mag(s.pos)
# outputs 10.77..., (spaceship has moved!)
to:
v1 = vector(1,0,0) # vector coincides with x axis
v2 = vector(0,1,0)
# vector coincides with y axis (vertical to v1)

print v1.diff_angle(v2) # outputs 1.5707963267948966 (pi/2), i.e., 90 degrees)

v3 = vector(-1,0,0)
# vector coincides with negative x axis (opposite of v1)

print v1
.diff_angle(v3) # outputs 3.1415926535897931 (pi, i.e., 180 degrees)
Changed lines 115-118 from:
!!!Velocity of Object

You can use
a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.
to:
ir '''dot product'''. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.


Given two vectors, v1 and v2, @@dot(v1, v1)@@ calculates their
'''dot product'''. This is a number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors.

If the two vectors are normalized, the dot product gives precisely the cosine of the angle between the vectors. That's another way to get the angle between the two vectors
.
Changed lines 123-139 from:
s.pos = vector(2,3,4) # location of spaceship in 3D space
s.velocity = vector(-5,2,1) # velocity of spaceship
s.speed
= mag(s.velocity) # speed of spaceship (displacement per unit time)
s.direction = norm(s.velocity)
# direction of spaceship

print mag
(s.pos) # outputs 5.38..., spaceship's distance from origin

s.pos = s.pos + s.speed * s.direction # move spaceship at this speed and direction

print s.pos # outputs (-3, 5, 5
)... spaceship has moved!
print mag(s.pos) # outputs 7.68..., spaceship's new distance from origin

# But s.speed * s.direction == s.velocity, since mag(v)*norm(v) == v, thus...
s.pos = s.pos + s.velocity # ... has the same effect

print s.pos # outputs (-8, 7, 6)... spaceship has moved!
print mag(s.pos) # outputs 12.20..., spaceship's new distance from origin
to:
v = vector(1,1,1)

print v
# outputs (1, 1, 1)

print v.mag
# outputs 1.7320508075688772, which is the same as sqrt(3)

v.mag
= 5 # set magnitude of v to 5

print v
# outputs (2.88675, 2.88675, 2.88675)
Added lines 134-190:

A nice property of the dot product is that if you multiply one of the vectors by the cosine of the angle (the one that you got by dividing the dot product by the lengths), you get the projection of the other vector onto that vector.

This may be useful in visualizing data represented by vectors. It may also be used to calculate the area associated with the two vectors.

For applications see http://www.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml

@@cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation

diff_angle, rotate

!!Useful Things You Can Do With Vectors

!!!Position of Object

You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.

(:source lang=Python tabwidth=3 -trim :)
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)

!!!Velocity of Object

You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.

(:source lang=Python tabwidth=3 -trim :)
s.pos = vector(2,3,4) # location of spaceship in 3D space
s.velocity = vector(-5,2,1) # velocity of spaceship
s.speed = mag(s.velocity) # speed of spaceship (displacement per unit time)
s.direction = norm(s.velocity) # direction of spaceship

print mag(s.pos) # outputs 5.38..., spaceship's distance from origin

s.pos = s.pos + s.speed * s.direction # move spaceship at this speed and direction

print s.pos # outputs (-3, 5, 5)... spaceship has moved!
print mag(s.pos) # outputs 7.68..., spaceship's new distance from origin

# But s.speed * s.direction == s.velocity, since mag(v)*norm(v) == v, thus...
s.pos = s.pos + s.velocity # ... has the same effect

print s.pos # outputs (-8, 7, 6)... spaceship has moved!
print mag(s.pos) # outputs 12.20..., spaceship's new distance from origin
(:sourcend:)
Added line 209:
# Bram de Greve, [[http://www.flipcode.com/articles/gprimer1_issue02.shtml | 3D Geometry Primer: Vector Arithmetic]], August 21, 2000.
Changed lines 100-103 from:
!!!Products

@@dot( vector1
, vector2 )@@ calculates the '''dot product''' of two vectors. This is a scalar number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors. If the two vectors are normalized, the dot product gives the cosine of the angle between the vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the area associated with the two vectors.
to:
!!!Dot Product, Cross Product

Given two vectors, v1 and v2, @@dot(v1, v1)@@ calculates their '''dot product'''. This is a number equal to
the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors. If the two vectors are normalized, the dot product gives precisely the cosine of the angle between the vectors.

This may be useful in visualizing data represented by vectors. It may also be used to calculate the area associated with the two vectors.
Added lines 104-105:
For applications see http://www.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml
Changed lines 35-36 from:
!!!Vector Components
to:
!!!Accessing Components
Changed lines 45-46 from:
!!!Vector Magnitude
to:
!!!Magnitude
Changed lines 71-72 from:
!!!Normal Vector
to:
!!!Normal
Changed lines 100-105 from:
!!!Vector Products

dot, cross

!!!Rotations
to:
!!!Products

@@dot( vector1, vector2 )@@ calculates the '''dot product''' of two vectors. This is a scalar number equal to the product of the magnitudes of the vectors, times the cosine of the angle between the two vectors. If the two vectors are normalized, the dot product gives the cosine of the angle between the vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the area associated with the two vectors.

@@
cross( vector1, vector2 )@@ calculates the '''cross product''' of two vectors. This is a vector perpendicular to the plane defined by the two vectors, in a direction defined by the right-hand rule: if the fingers of the right hand bend from vector1 toward vector 2, the thumb points in the direction of the cross product. The magnitude of this vector is equal to the product of the magnitudes of vector1 and vector2, times the sine of the angle between the two vectors. This may be useful in visualizing data represented by vectors. It may also be used to calculate the areas and volumes.


To find the angle between two vectors (the "difference" of the angles of the two vectors) use @@vector1.diff_angle(vector2)@@

!!!Rotation
Changed lines 176-177 from:
to:
# [[http://www.engin.umich.edu/class/bme456/ch1mathprelim/bme456mathprelim.htm | Biosolid Mechanics: Modeling and Applications]] - application
Changed lines 3-4 from:
This section is intended to give you a working knowledge of vectors, so that you may apply it in the context of game development and data visualization. This material is compiled from various sources as noted.
to:
This section is intended to give you a working knowledge of vectors, so that you may apply it in the context of game development and data visualization. [-(This material is compiled from various sources as noted.)-]
Added lines 149-152:
!!!Bouncing Off the Wall

to
Added lines 106-107:
diff_angle, rotate
Added lines 110-111:
!!!Position of Object
Added lines 125-126:
!!!Velocity of Object
Changed lines 149-150 from:
You can rotate a vector by a scalar.
to:
!!!Follow the Leader

You have two objects, ob1 and ob2 moving in space, and you wish to ob2 to follow ob1
.

1) Easier set ob2.velocity to ob1.velocity - instantenous turn

2) smooth turn - get angle diff between ob1.vel and ob2.vel. get cross product of ob1.vel and ob2.vel. set ob2.vel to rotate (ob2.vel, min(angle_diff, maxTurningCapacity), crossProduct)
Added lines 35-36:
!!!Vector Components
Added lines 45-46:
!!!Vector Magnitude
Added lines 71-72:
!!!Normal Vector
Changed lines 80-81 from:
n1 = norm(v1) # normalize it
to:
n1 = norm(v1) # get the normal vector
Changed lines 91-92 from:
n2 = norm(v2) # normalize it
to:
n2 = norm(v2) # get the normal vector
Added lines 100-105:
!!!Vector Products

dot, cross

!!!Rotations
Changed lines 147-148 from:
1. The Game Programming Wiki, [[http://gpwiki.org/index.php/Math:Vector | Vector]].
to:
# The Game Programming Wiki, [[http://gpwiki.org/index.php/Math:Vector | Vector]].
# Wikipedia, [[http://en.wikipedia.org/wiki/Vector_(spatial) | Vector (spatial)]], October 10, 2006
.
Changed lines 131-132 from:
to:
You can rotate a vector by a scalar.
Added line 139:
# Alex Diener, [[http://www.sacredsoftware.net/tutorials/Quaternions/Quaternions.xhtml | Quaternions Tutorial]] - representing 3D rotations.
Changed lines 43-44 from:
If the vector represents a point, the '''magnitude''' of the vector represents the (Euclidean) distance of the point from the origin. You can also refer to the square of the magnitude:
to:
If the vector represents a point, the '''magnitude''' of the vector represents the (Euclidean) distance of the point from the origin. You can refer to the square of the magnitude:
Changed lines 53-54 from:
You can also obtain and modify the magnitude in the form @@v.mag@@, and the square of the magnitude as @@v.mag2@@:
to:
You can access (and modify!) the magnitude of a vector @@v@@ using @@v.mag@@, and the square of the magnitude using @@v.mag2@@:
Changed lines 67-68 from:
An important operation on vectors is normalization. In essense, this scales a vector of any direction and magnitude to a vector with the same direction and magnitude of 1.
to:
An important operation on vectors is '''normalization'''. In essense, this scales a vector of any direction and magnitude to a vector with the same direction and magnitude of 1.
Changed lines 109-110 from:
You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) speed of the object. The normal of the vector is the direction of the object.
to:
You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) '''speed''' of the object. The normal of the vector is the '''direction''' of the object.
Changed lines 43-44 from:
You can also obtain the magnitude of a vector, as well as the square of the magnitude:
to:
If the vector represents a point, the '''magnitude''' of the vector represents the (Euclidean) distance of the point from the origin. You can also refer to the square of the magnitude:
Changed lines 48-49 from:
print mag(v) # outputs 1.7320508075688772, which is the same as sqrt(3)
to:
print mag(v) # outputs 1.7320508075688772, which is the same as sqrt(1**2 + 1**2 + 1**2), i.e., sqrt(3)
Changed line 114 from:
s.speed = mag(s.velocity) # speed of spaceship
to:
s.speed = mag(s.velocity) # speed of spaceship (displacement per unit time)
Changed lines 99-106 from:
spaceship.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(spaceship.pos) # outputs 5.38... (distance of spaceship from origin)

spaceship.pos = spaceship.pos + vector(2,3,4)

print spaceship.pos # outputs (4, 6, 8)
print mag(spaceship.pos) # outputs 10.77..., (spaceship has moved!)
to:
s.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(s.pos) # outputs 5.38... (distance of spaceship from origin)

s.pos = s.pos + vector(2,3,4)

print s.pos # outputs (4, 6, 8)
print mag(s.pos) # outputs 10.77..., (spaceship has moved!)
Changed lines 112-124 from:
spaceship.pos = vector(2,3,4) # location of spaceship in 3D space
spaceship.velocity = vector(-5,2,1)
# velocity of spaceship
spaceship.speed = mag(spaceship.velocity) # speed of spaceship
spaceship.direction = norm(spaceship.velocity) # direction of spaceship

spaceship.pos =


print mag(spaceship.pos)
# outputs 5.38... (distance of spaceship from origin)

spaceship
.pos = spaceship.pos + vector(2,3,4)

print spaceship
.pos # outputs (4, 6, 8)
print mag(spaceship.pos)
# outputs 10.77..., (spaceship has moved!)
to:
s.pos = vector(2,3,4) # location of spaceship in 3D space
s.velocity = vector(-5,2,1)
# velocity of spaceship
s.speed = mag(s.velocity)
# speed of spaceship
s.direction = norm(s.velocity) # direction of spaceship

print mag(s.pos)
# outputs 5.38..., spaceship's distance from origin

s
.pos = s.pos + s.speed * s.direction # move spaceship at this speed and direction

print s.pos
# outputs (-3, 5, 5)... spaceship has moved!
print mag(s.pos) # outputs 7.68..., spaceship's new distance from origin

# But s.speed * s.direction == s.velocity, since mag(v)*norm(v) == v, thus...
s.pos = s.pos + s.velocity # ... has the same effect

print s.pos # outputs (-8, 7, 6)... spaceship has moved!
print mag(s.pos) # outputs 12.20..., spaceship's new distance from origin
Changed lines 96-97 from:
You can use a vector to store the position of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
to:
You can use a vector to store the '''position''' of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
Changed lines 109-112 from:
* You can use a vector to store the velocity of an object. In this case, the magnitude of the vector is the (instantaneous) speed of the object.
to:
You can use a vector to store the (instantaneous) '''velocity''' of an object. In this case, the magnitude of the vector is the (instantaneous) speed of the object. The normal of the vector is the direction of the object.

(:source lang=Python tabwidth=3 -trim :)
spaceship.pos = vector(2,3,4) # location of spaceship in 3D space
spaceship.velocity = vector(-5,2,1) # velocity of spaceship
spaceship.speed = mag(spaceship.velocity) # speed of spaceship
spaceship.direction = norm(spaceship.velocity) # direction of spaceship

spaceship.pos =

print mag(spaceship.pos) # outputs 5.38... (distance of spaceship from origin)

spaceship.pos = spaceship.pos + vector(2,3,4)

print spaceship.pos # outputs (4, 6, 8)
print mag(spaceship.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)
Changed lines 135-136 from:
to:
# Sparknotes SAT Physics, [[http://www.sparknotes.com/testprep/books/sat2/physics/chapter5section2.rhtml | Speed, Velocity, and Acceleration]].
Changed lines 96-97 from:
* You can use a vector to store the position of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.
to:
You can use a vector to store the position of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.

(:source lang=Python tabwidth=3 -trim :)
spaceship.pos = vector(2,3,4) # location of spaceship in 3D space

print mag(spaceship.pos) # outputs 5.38... (distance of spaceship from origin)

spaceship.pos = spaceship.pos + vector(2,3,4)

print spaceship.pos # outputs (4, 6, 8)
print mag(spaceship.pos) # outputs 10.77..., (spaceship has moved!)
(:sourcend:)
Changed lines 107-108 from:
to:
# Alex Diener, [[http://www.sacredsoftware.net/tutorials/Vectors/Vectors.xhtml | Vector Tutorial]].
Changed lines 17-19 from:
!!!Addition, Subtraction,
Vectors
can be added or subtracted from each other; also they can be multiplied or divided by an ordinary number (a scalar). For example,
to:
!!!Addition, Subtraction, Multiplication, Division

Vectors
can be added to or subtracted from each other. Also they can be multiplied or divided by an ordinary number (a scalar). For example,
Added lines 92-101:
'''Note:''' It is illegal to normalize vector (0,0,0), since this involves division by zero (i.e., @@norm(v1) = v1 / mag(v1)@@).

!!Useful Things You Can Do With Vectors

* You can use a vector to store the position of an object in space (2D, 3D, etc.). In this case, the magnitude is the distance from the origin.

* You can use a vector to store the velocity of an object. In this case, the magnitude of the vector is the (instantaneous) speed of the object.

Changed lines 71-78 from:
print mag(v1) # outputs 8.77496438739

v1Normal = norm(v1) # normalize it

print mag(v1Normal) # outputs 1.0

print v1Normal
# outputs (0.455842, 0.569803, 0.683763)
to:
print mag(v1) # outputs 8.77496438739

n1 = norm(v1)
# normalize it

print mag(n1) # outputs 1.0

print n1
# outputs (0.455842, 0.569803, 0.683763)
Changed lines 82-88 from:
print mag(v2) # outputs 6.40340534403

v2Normal = norm(v2) # normalize it

print mag(v2Normal) # outputs 1.0

print v2Normal
# outputs (0.624668, -0.780835, 0.00937001)
to:
print mag(v2) # outputs 6.40340534403

n2 = norm(v2)
# normalize it

print mag(n2) # outputs 1.0

print n2
# outputs (0.624668, -0.780835, 0.00937001)
Added lines 70-79:

print mag(v1) # outputs 8.77496438739

v1Normal = norm(v1) # normalize it

print mag(v1Normal) # outputs 1.0

print v1Normal # outputs (0.455842, 0.569803, 0.683763)

# another example
Changed lines 82-92 from:
print mag(v1) # outputs 8.77496438739
print mag(v2)
# outputs 6.40340534403

# normalize them
v1Normal = norm(v1)
v2Normal = norm(v2)

print mag(v1Normal) # outputs
1.0
print mag(v2Normal) # outputs 1.0

print v1Normal # outputs (0.455842, 0.569803, 0.683763)
to:
print mag(v2) # outputs 6.40340534403

v2Normal = norm(v2)
# normalize it

print mag(v2Normal)
# outputs 1.0
Changed lines 17-18 from:
Vectors can be added or subtracted from each other, or multiplied by an ordinary number (a scalar). For example,
to:
!!!Addition, Subtraction,
Vectors can be added or subtracted from each
other; also they can be multiplied or divided by an ordinary number (a scalar). For example,
Changed lines 25-29 from:
print v1+v2 # outputs (11 22 33)

print v1-v2 # outputs (-9, -18, -27)

print 2*v1 # outputs (2 4 6)
to:
print v1 + v2 # outputs (11, 22, 33)

print v1 - v2 # outputs (-9, -18, -27)

print v1 * 2 # outputs (2, 4, 6)

print v1 / 2 # outputs (0.5, 1, 1.5
)
Changed lines 69-71 from:
print mag(v1) # outputs 8.77496438739
print mag(v2)
# outputs 6.40340534403
to:
print mag(v1) # outputs 8.77496438739
print mag(v2) # outputs 6.
40340534403

# normalize them
Added lines 76-78:
print mag(v1Normal) # outputs 1.0
print mag(v2Normal) # outputs 1.0
Deleted lines 80-82:

print mag(v1Normal) # outputs 1.0
print mag(v2Normal) # outputs 1.0
Changed lines 49-50 from:
You can also access the magnitude in the form @@v.mag.@@ and the square of the magnitude as @@v.mag2@@:
to:
You can also obtain and modify the magnitude in the form @@v.mag@@, and the square of the magnitude as @@v.mag2@@:
Changed lines 63-81 from:
to:
An important operation on vectors is normalization. In essense, this scales a vector of any direction and magnitude to a vector with the same direction and magnitude of 1.

(:source lang=Python tabwidth=3 -trim :)
v1 = vector(4,5,6)
v2 = vector(4,-5,0.06)

print mag(v1) # outputs 8.77496438739
print mag(v2) # outputs 6.40340534403

v1Normal = norm(v1)
v2Normal = norm(v2)

print v1Normal # outputs (0.455842, 0.569803, 0.683763)
print v2Normal # outputs (0.624668, -0.780835, 0.00937001)

print mag(v1Normal) # outputs 1.0
print mag(v2Normal) # outputs 1.0
(:sourcend:)
Changed lines 49-50 from:
You can also obtain the magnitude in the form v2.mag. and the square of the magnitude
to:
You can also access the magnitude in the form @@v.mag.@@ and the square of the magnitude as @@v.mag2@@:

(:source lang=Python tabwidth=3 -trim :)
v = vector(1,1,1)

print v # outputs (1, 1, 1)

print v.mag # outputs 1.7320508075688772, which is the same as sqrt(3)

v.mag = 5 # set magnitude of v to 5

print v # outputs (2.88675, 2.88675, 2.88675)
(:sourcend:)
Changed lines 42-47 from:
v2 = vector(1,1,1)

mag(vector(1,1,1)) # is equal to sqrt(3)
mag2(vector(
1,1,1)) # is equal to 3, the magnitude squared

print v2.x, v2.y, v2.z # outputs 10 20 30
to:
v = vector(1,1,1)

print mag(v) # outputs 1.7320508075688772, which is the same as sqrt(3)

print mag2(v) # outputs 3, the magnitude squared
Changed lines 1-2 from:
!Intro to Vectors
to:
!Vectors for Game Development and Data Visualization
Added line 5:
!!Introduction
Changed lines 12-15 from:
In game programming most points and vectors will have 2 or 3 dimensions, but occasionally they may have 4. Points and vectors may be written as (x,y) or (x,y,z). In VPython points and vectors are represented as vector(x,y) or vector(x,y,z), where x, y, and z are real numbers.

to:
In game programming most points and vectors will have 2 or 3 dimensions, but occasionally they may have 4. Points and vectors may be written as ''(x,y)'' or ''(x,y,z)''. In VPython points and vectors are represented as @@vector(x,y)@@ or @@vector(x,y,z)@@, where ''x, y,'' and ''z'' are floating-point numbers.

!!Operations on Vectors
[-(adopted from [[http://www.vpython.org/webdoc/visual/vector.html | VPython Reference Manual]])-]

Vectors can be added or subtracted from each other, or multiplied by an ordinary number (a scalar). For example,

(:source lang=Python tabwidth=3 -trim :)
v1 = vector(1,2,3)

v2 = vector(10,20,30)

print v1+v2 # outputs (11 22 33)

print v1-v2 # outputs (-9, -18, -27)

print 2*v1 # outputs (2 4 6)
(:sourcend:)

You can refer to individual components of a vector:

(:source lang=Python tabwidth=3 -trim :)
v = vector(10,20,30)

print v.x, v.y, v.z # outputs 10 20 30
(:sourcend:)

You can also obtain the magnitude of a vector, as well as the square of the magnitude:

(:source lang=Python tabwidth=3 -trim :)
v2 = vector(1,1,1)

mag(vector(1,1,1)) # is equal to sqrt(3)
mag2(vector(1,1,1)) # is equal to 3, the magnitude squared

print v2.x, v2.y, v2.z # outputs 10 20 30
(:sourcend:)

You can also obtain the magnitude in the form v2.mag. and the square of the magnitude
Changed lines 3-7 from:
This section is intended to give you a working knowledge of vectors, so that you may apply it in the context of game development and data visualization. [-(This material has been compiled from various sources listed at the bottom.-]

A vector is , is a concept characterized by a magnitude and a direction
.
to:
This section is intended to give you a working knowledge of vectors, so that you may apply it in the context of game development and data visualization. This material is compiled from various sources as noted.

[
-(adopted from [[http://gpwiki.org/index.php/Math:Vector | The Game Programming Wiki]])-]

Vectors are an essential part of graphics, physics, game logic and even a lot of AI for games
. They are not very complicated but to use them effectively you'll need to know a few things.

A ''point'' is a position in space. A ''vector'' has ''direction'' and ''magnitude''. The two are distinct concepts but have the same representation, so they are often confused. It is common to use vectors to represent both, since a point can be thought of as a vector starting from the origin.

In game programming most points and vectors will have 2 or 3 dimensions, but occasionally they may have 4. Points and vectors may be written as (x,y) or (x,y,z). In VPython points and vectors are represented as vector(x,y) or vector(x,y,z), where x, y, and z are real numbers.
Added line 17:
1. The Game Programming Wiki, [[http://gpwiki.org/index.php/Math:Vector | Vector]].
Added lines 1-13:
!Intro to Vectors

This section is intended to give you a working knowledge of vectors, so that you may apply it in the context of game development and data visualization. [-(This material has been compiled from various sources listed at the bottom.-]

A vector is , is a concept characterized by a magnitude and a direction.


!!Sources

# VPython, [[http://www.vpython.org/webdoc/visual/vector.html | The vector Object]], Reference Manual.
# Johan van Mol, [[http://www.johanvanmol.org/content/view/45/37/1/6/ | Bouncing off sloped walls]], September 10, 2006.