This function does not depend on 3JS, it runs purely on JavaScript.

It takes 3 arguments( **A**, **B**, **L** ).

**A** & **B** can be a THREE.Vector3() or an [object Object] with x, y, z keys assign to a number.

Argument **L** is a number that is added the segment length to find the target point.

If **L** is positive, the point will be in **AB** direction.

If **L** is negative, the point will be in **BA** direction.

The return value of the function is an [object Array] representing x,y,z of target point.

The function can be easily modified to return “*X amount on both sides”*.

```
function ext_l_seg( A, B, L ) {
var AB = [ B.x - A.x, B.y - A.y, B.z - A.z ];
var AB_length = Math.hypot( ...AB );
return [ 'x', 'y', 'z' ].map( ( _ , i ) => AB[i] * L / AB_length + A[_] );
}
alert( ext_l_seg( { x: 1, y: 1, z: 0 }, { x: 3, y: 3, z: 0 }, 2 ). join('\n') );
```