src/SceneHelper.js
/**
     * moves the camera to a good position to watch over the whole plot
     * @param {object} dimensions {xLen, yLen, zLen} 
     */
moves the camera to a good position to watch over the whole plot
@param {object} dimensions {xLen, yLen, zLen}
moves the camera to a good position to watch over the whole plot @param { object } dimensions { xLen yLen zLen }
centerCamera(dimensions)
    {
        let xLen = dimensions.xLen
        let yLen = dimensions.yLen
        let zLen = dimensions.zLen
        let zoom = 80/this.camera.fov
        if(this.camera.type === "OrthographicCamera")
            zoom = 1
        let x, y, z
        if(this.cameraMode === DEFAULTCAMERA)
        {
            x = zoom*(xLen/2)
            y = zoom*(Math.max(zLen, yLen))
            z = zoom*(zLen+xLen)
        }
        else if(this.cameraMode === TOPCAMERA)
        {
            x = xLen/2
            y = Math.max(xLen,zLen)*2
            z = zLen/2
            this.camera.initial_y = y
        }
        else if(this.cameraMode === LEFTCAMERA)
        {
            x = -Math.max(yLen,zLen)*2
            y = yLen/2
            z = zLen/2
            this.camera.initial_x = x
        }
        else if(this.cameraMode === FRONTCAMERA)
        {
            x = xLen/2
            y = yLen/2
            z = Math.max(xLen,yLen)*2
            this.camera.initial_z = z
        }
        this.camera.position.set(x, y, z)
        this.cameraControls.target.set(xLen/2, yLen/2, zLen/2)
        this.camera.lookAt(this.cameraControls.target)
        this.render()
    }
centerCamera ( dimensions ) { let xLen = dimensions . xLen let yLen = dimensions . yLen let zLen = dimensions . zLen let zoom = 80 / this . camera . fov if ( this . camera . type === "OrthographicCamera" ) zoom = 1 let x , y , z if ( this . cameraMode === DEFAULTCAMERA ) { x = zoom * ( xLen / 2 ) y = zoom * ( Math . max ( zLen , yLen ) ) z = zoom * ( zLen + xLen ) } else if ( this . cameraMode === TOPCAMERA ) { x = xLen / 2 y = Math . max ( xLen , zLen ) * 2 z = zLen / 2 this . camera . initial_y = y } else if ( this . cameraMode === LEFTCAMERA ) { x = - Math . max ( yLen , zLen ) * 2 y = yLen / 2 z = zLen / 2 this . camera . initial_x = x } else if ( this . cameraMode === FRONTCAMERA ) { x = xLen / 2 y = yLen / 2 z = Math . max ( xLen , yLen ) * 2 this . camera . initial_z = z } this . camera . position . set ( x , y , z ) this . cameraControls . target . set ( xLen / 2 , yLen / 2 , zLen / 2 ) this . camera . lookAt ( this . cameraControls . target ) this . render ( ) }
moves the camera to a good position to watch over the whole plot
 @param {object} dimensions {xLen, yLen, zLen}
moves the camera to a good position to watch over the whole plot @param { object } dimensions { xLen yLen zLen }
// 80 is the default camera.fov value. A less perspectivic view can be achieved using a smaller value, but it has to be moved farther away // topCamera // leftCamera // frontCamera