How do I set the model to take up half of the current screen?

How do I set the model to take up half of the current screen ?

I tried auto-scaling, but the calculations were probably wrong, the results were never good, and I often had problems setting up parts of the model to auto-scale.

this is the effect : http://bmw.jingge.com/presale/jgzs3d-byde5yctbddj/

error effect

the auto scale code

function autoScaleObjectMatchScreen(object:any, offset:number) {
    offset = offset || 40;

    // // 初始加载模型后,自动计算模型大小,进行缩放,显示模型;
    let box:any = new THREE.Box3().setFromObject( object );
    let size = new THREE.Vector3();
    box.getSize( size );
    // let scaleVec:any = new THREE.Vector3().divide( size );
    let scaleVec:any = new THREE.Vector3( 1, 1, 1 ).divide( size );
    // let scale = Math.min( scaleVec.x, Math.min( scaleVec.y, scaleVec.z ));
    let scale = Math.max( scaleVec.x, Math.max( scaleVec.y, scaleVec.z ));
    // object.scale.setScalar( scale * offset );
    return scale * offset;
}
function autoScaleMatchScreen(object:any, camera:any, scene:any, offset?:number) {
    offset = offset || 0.4; 

    const screen = {width:document.body.offsetWidth, height:document.body.offsetHeight};
    let group = object;

    let box:any = new THREE.Box3();
    // box.expandByObject(group);
    let bbox = box.setFromObject(group);
    let mdlen=bbox.max.x-bbox.min.x; //边界的最小坐标值 边界的最大坐标值
    let mdhei=bbox.max.y-bbox.min.y;
    let mdwid=bbox.max.z-bbox.min.z;

    // group.position.set(0,0,0);
    // const height = bbox.size().y;
    // const dist2 = height / (2 * Math.tan(camera.fov * Math.PI / 360));
    // const pos = object.position;
    // camera.position.set(pos.x, pos.y, dist * 2.1); // fudge factor so you can see the boundaries camera.lookAt(pos);

    let dist =Math.abs(camera.position.z - group.position.z- (mdwid/2));
    //console.log('dist值为:' + dist );
    let vFov = camera.fov * Math.PI/180;
    //console.log('vFov值为:' + vFov );
    // let vheight = 2 * Math.tan(vFov * 0.5) *dist;
    let vheight = 2 * Math.tan(vFov * offset) *dist;
    //console.log('vheight值为:' + vheight );
    let fraction = mdhei / vheight;
    // console.log('fraction值为:' + fraction );
    let finalHeight = screen.height * fraction ;
    //console.log('finalHeight值为:' + finalHeight);
    let finalWidth = (finalHeight*mdlen) /mdhei;
    //console.log('finalWidth值为:' + finalWidth );

    let value1 = screen.width/finalWidth;
    console.log('value1缩放比例值为:' + value1);
    let value2 = screen.height/finalHeight;
    console.log('value2缩放比例值为:' + value2);

    if(value1 >= value2){
        // group.scale.set(value2,value2,value2);
        // group.scale.set(value2,value2,value2);
        console.log('按宽度值计算缩放比:' + value1);
        return value2;
    }
    else{
        // group.scale.set(value1,value1,value1);
        // group.scale.set(value1,value1,value1);
        console.log('按高度值计算缩放比:' + value2)
        return value1;
    }
}

This method autoScaleMatchScreen is used for scaling individual parts of the model
This method autoScaleObjectMatchScreen is used for scaling individual the model overall .

Or can zoom in on the model by changing the distance of the camera, but how do you figure out the right value ?