You are not properly setting `optionalIntersectionPoint`.
   
    if ( directionDistance < 0 ) {

        v.copy( this.origin );

    } else {

        v.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin );

    }

    return v.distanceTo( point );