I am working with point3D and vector3D classes and I need some help adjusting a point by a given distance.

* Point A - point residing at coordinate 0,0,0.
* Point B - point residing at coordinate 1,1,1.
* Vector AB - vector AB which tells me the length between the two points A and B is distance = 1.73205078.

![enter image description here](https://i.stack.imgur.com/gvXH2.png)

Code:

```
Point3D A = new Point3D { X = 0, Y = 0, Z = 0 };
Point3D B = new Point3D { X = 1, Y = 1, Z = 1 };
Vector3D AtoB = A - B;
Double distanceBetweenAandB = AtoB.Length; // the distance will be 1.73205078 here.

```

I would like to adjust point B. I would like to reduce the distance between point A and point B to 0.5 instead of 1 (adjusting to position C as shown in the diagram). I am trying to work out how to do this.

Point A (0,0,0) is known, point B (1,1,1) is known and the distance to adjust by is known (0.5). How do I calculate?

Pseudo code:

```
Point3D A = new Point3D { X = 0, Y = 0, Z = 0 };
Point3D B = new Point3D { X = 1, Y = 1, Z = 1 };
Double distanceToAdjust = 0.5;

Point3D newCoordinate = B - distanceToAdjust; // this doesnt work!

```

Adjusted point B shown in diagram below:

![enter image description here](https://i.stack.imgur.com/V5ND5.png)

I am using my own defined Point3D class and Vector3D class.