Finding a rotation around a point
I've managed to get a function working which will calculate and return the angle between one point and another. I've called it the `lookAt` function, because it's basically causing one transform to look at another one. Here it is:

    this.lookAt = function(target) {
    	var d = target.subtract(this.position)
    	this.rotation = Math.atan2(d.y, d.x) + Math.PI/2;
    	return this.rotation;
    }

In this function's context, `this` refers to a surrounding object which has the variables `rotation` (a rotation in radians) and `position`, a `Vector2` class which has a few basic math functions and stores `x` and `y` values. `d` is a `Vector2` created by calling a helper function on the variable `target`, which subtracts one `Vector2` from another.

This works as expected--if I call this function on an object, the rotation correctly "looks at" the target. However, I'd like to know why I had to add `π / 2` (which is 1 radian, correct?). I got the original equation from [this question][1], but the answer did not add `π / 2` to the equation, whereas I have to. 

Could somebody explain the math behind this? Also, I haven't gotten to that much trigonometry yet (besides what my Algebra course introduced me to), so please explain this as if you were talking to a very small child. :-)


  [1]: http://stackoverflow.com/questions/4684195/calculating-in-radians-the-rotation-of-one-point-around-another
Finding a rotation around a point
===

I've managed to get a function working which will calculate and return the angle between one point and another. I've called it the `lookAt` function, because it's basically causing one transform to look at another one. Here it is:

    this.lookAt = function(target) {
    	var d = target.subtract(this.position)
    	this.rotation = Math.atan2(d.y, d.x) + Math.PI/2;
    	return this.rotation;
    }

In this function's context, `this` refers to a surrounding object which has the variables `rotation` (a rotation in radians) and `position`, a `Vector2` class which has a few basic math functions and stores `x` and `y` values. `d` is a `Vector2` created by calling a helper function on the variable `target`, which subtracts one `Vector2` from another.

This works as expected--if I call this function on an object, the rotation correctly "looks at" the target. However, I'd like to know why I had to add `π / 2` (which is 1 radian, correct?). I got the original equation from [this question][1], but the answer did not add `π / 2` to the equation, whereas I have to. 

Could somebody explain the math behind this? Also, I haven't gotten to that much trigonometry yet (besides what my Algebra course introduced me to), so please explain this as if you were talking to a very small child. :-)


  [1]: http://stackoverflow.com/questions/4684195/calculating-in-radians-the-rotation-of-one-point-around-another