* Projects this vector onto the given one. * * @param {Vector3} v - The vector to project to. * @return {Vector3} A reference to this vector.
( v )
| 887 | * @return {Vector3} A reference to this vector. |
| 888 | */ |
| 889 | projectOnVector( v ) { |
| 890 | |
| 891 | const denominator = v.lengthSq(); |
| 892 | |
| 893 | if ( denominator === 0 ) return this.set( 0, 0, 0 ); |
| 894 | |
| 895 | const scalar = v.dot( this ) / denominator; |
| 896 | |
| 897 | return this.copy( v ).multiplyScalar( scalar ); |
| 898 | |
| 899 | } |
| 900 | |
| 901 | /** |
| 902 | * Projects this vector onto a plane by subtracting this |
no test coverage detected