// 相机参数
export const uavModel = {
    "m4td":{
        "focalLength":6.83,
        "sensorLength":9.85,
        "imageWidth":4032,
        "imageHeight":0,
    }
}

// 输入gsd计算高度
export const calculateHeight = (gsd,uavModel) => {
    let height = 0;
    height = ( (gsd / 100) * (uavModel['focalLength'] / 1000) * uavModel['imageWidth'] ) / ( uavModel['sensorLength'] / 1000 );
    return height.toFixed(2);

}

// 输入高度计算gsd
export const calculateGsd = (height,uavModel) => {
    let gsd = 0;
    gsd = ( (height*1000) * uavModel['sensorLength'] ) / (uavModel['focalLength'] * uavModel['imageWidth']) / 10;
    return gsd.toFixed(2);
}

// 计算航线间距
export const calculateSpacing = (gsd,overlap,uavModel) => {
    let groundResolution = gsd / 100;
    let lineSpacing = groundResolution  *  uavModel['imageWidth'] * (1 - overlap);
    return lineSpacing.toFixed(2);
}