转自:http://www.ziggyware.com/readarticle.php?article_id=54
Lets look into some basic math in XNA:
What is a vector?
A vector is a point in space that represents the location or direction of a given point. Not just a point in space. Basically, it is a point in space that has a direction from somewhere else. In the case of the image below the fector would be the red line because it extends from the origin to 10,10 so it has a direction.

Lets look into some basic math in XNA:
What is a vector?
A vector is a point in space that represents the location or direction of a given point. Not just a point in space. Basically, it is a point in space that has a direction from somewhere else. In the case of the image below the fector would be the red line because it extends from the origin to 10,10 so it has a direction.

Note that the point is represented as an arrow from the world 0,0 to object A
This is a good way to think of a vector
Lets look at how to calculate the distance between two vectors.
To get the distance we need to calculate a vector from one object to the other.
Lets see what the vector looks like from object A to object B:

Note the subtraction of B from A. This gives you new Vector from A to B. This new vector will contain the value: (0,10) since A(10,10) + AtoB(0,10) = B(10,20)
Now lets get the distance between A and B. This can be obtained by retrieving the length of the vector from A to B:

Lets look at how to rotate a Vector2:

This can be achieved by using a little trig:
Lets calculate the new position using a 2d rotation matrix:
This will calculate the rotation of a vector in a counter clockwise rotation so be sure to set the rotation negative if you want to rotate it clockwise.
Here is the wikipedia image of a 2d rotation matrix (click to view the article in wikipedia):

Lets see how to calculate the angle between two vectors:
Here we are calculating the inverse cosing of the dot product of the vectors A and B. Since this only works with unit vectors (vectors of length 1) we need to Normalize the values first.
The Dot product returns the cosine of the angle between the two vectors.
We need to reverse the value if the vector from A to NewA's X is > 0. This is a little hack to make sure the rotation is reversed at negative rotations since it will give us an answer that is the opposite of what we are looking for :)
Setting the direction of a sprite:
Missing XNA Math Functions
Closes Point On Line Segment
Point Inside Edge
Point Inside Poly
Plane Dot Coord
Plane Dot Normal
Ray Plane Intersection
I do not remember the reference where I found this information. If anyone knows respond in the comments below.
Closest Point On Plane
Plane - Matrix Multiply
(Plane Transform)Submitted by Dr^Nick
Distance from point to Plane
Authored by johnnylightbulb
Ray Intersects Box
Authored by Phantom