You can increase the vector of nonzero length by three .js along the len length as follows:
var oldLength = vector.length(); if ( oldLength !== 0 ) { vector.multiplyScalar( 1 + ( len / oldLength ) ); }
So, here is how you calculate point C
var A = new THREE.Vector3( 10, 20, 30 ); var B = new THREE.Vector3( 20, 30, 40 ); var C = new THREE.Vector3(); var len = 10; C.subVectors( B, A ).multiplyScalar( 1 + ( len / C.length() ) ).add( A );
three.js r.69
source share