Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two points (A, B) and the length of d. How can I find point C?


share|improve this question
up vote 26 down vote accepted

Compute a vector V from A to B, and normalize it.

V = (B - A) / |B - A|

Since the vector is normalized, it will have a length of one, and it will indicate the direction of B relative to A. If you then scale the vector by d you will have the displacement from A to C

V' = d * V

which you can simply add to A to yield C:

C = V' + A
share|improve this answer
works perfect!!!! thanks!!! :) – eempee Oct 10 '11 at 18:25
btw: could anyone recommend me a book where I can learn about stuff like that? :) – eempee Oct 10 '11 at 20:40
3D Math primer is a good one:…;. – Ricky AH Oct 11 '11 at 8:03
Didn't read this one, but I've been told that is also pretty good… – Ricky AH Oct 11 '11 at 8:05
See this question:… – Josh Petrie Oct 11 '11 at 15:06

In case your d is a ratio instead of a length, e.g 0.5 puts it on equal distance from A and B, you can do the following and avoid a normalization:

C = A * (1 - ratio) + B * ratio
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.