首页 > 其他分享 >110004 求AB距离方位角已知点A点B坐标

110004 求AB距离方位角已知点A点B坐标

时间:2022-12-05 00:23:16浏览次数:37  
标签:110004 AB arctan 方位角 110 80 坐标

<?php
header('Content-Type: text/html; charset=utf-8');
define ('ROOT', $_SERVER['DOCUMENT_ROOT']);
include ROOT.'/assets/php/head.php';

$tit= '求AB距离方位角已知点A点B坐标';
//xA:100;yA:80;xB:140;yB:110;
$val='100 80 140 110';
$img='';

//调用方法
mill($val,$img,$tit);

/**
 * mill 是磨粉机的方法
 * $val 传值过来计算,以空格分割成数值
 * $img 自定义图片名,默认以文件名为图片名
 * $tit 标题名
 * */
function mill($val,$img,$tit){
    //初始化
    include ROOT.'/assets/php/init.php';
    imgt($img,$tit);

    //设置小数点保留位数 
    bcscale (2);
    //$pi = round(pi(),2);
    
    //以空格分割成数值
    $vals = expl($val);
    $xA = evev($vals[0]);
    $yA = evev($vals[1]);
    $xB = evev($vals[2]);
    $yB = evev($vals[3]);

    //已知条件
    $know = array();
    array_push($know, $val);
    $v0 = eveq($vals[0]);
    array_push($know, "点A的x坐标:$v0");
    $v1 = eveq($vals[1]);
    array_push($know, "点A的y坐标:$v1");
    $v2 = eveq($vals[2]);
    array_push($know, "点B的x坐标:$v2");
    $v3 = eveq($vals[3]);
    array_push($know, "点B的y坐标:$v3");

    //计算步骤
    $step = array();
    array_push($step, "求AB的距离:");
    array_push($step, "{$math['eq']} {$math['root2l']}{$math['abs']}$xA{$math['sub']}$xB{$math['abs']}{$math['sup2']}{$math['add']}{$math['abs']}$yA{$math['sub']}$yB{$math['abs']}{$math['sup2']}{$math['root2r']}");
    $xAxB = bcsub($xA, $xB);
    $yAyB = bcsub($yA, $yB);
    array_push($step, "{$math['eq']} {$math['root2l']}{$math['abs']}$xAxB{$math['abs']}{$math['sup2']}{$math['add']}{$math['abs']}$yAyB{$math['abs']}{$math['sup2']}{$math['root2r']}");
    $xAxBabs = abs($xAxB);
    $yAyBabs = abs($yAyB);
    array_push($step, "{$math['eq']} {$math['root2l']}$xAxBabs{$math['sup2']}{$math['add']}$yAyBabs{$math['sup2']}{$math['root2r']}");
    $xAxBabs2 = bcpow($xAxBabs, 2);
    $yAyBabs2 = bcpow($yAyBabs, 2);
    array_push($step, "{$math['eq']} {$math['root2l']}$xAxBabs2{$math['add']}$yAyBabs2{$math['root2r']}");
    $xAxBabs2yAyBabs2 = bcadd($xAxBabs2, $yAyBabs2);
    array_push($step, "{$math['eq']} {$math['root2']}$xAxBabs2yAyBabs2");
    $AB = bcsqrt($xAxBabs2yAyBabs2);
    array_push($step, "{$math['eq']} $AB");
    
    array_push($step, "求AB的方位角:");
    array_push($step, "{$math['eq']} arctan{$math['lpar']}{$math['abs']}$yA{$math['sub']}$yB{$math['abs']}{$math['div']}{$math['abs']}$xA{$math['sub']}$xB{$math['abs']}{$math['rpar']}");
    $yAyB = bcsub($yA, $yB);
    $xAxB = bcsub($xA, $xB);
    array_push($step, "{$math['eq']} arctan{$math['lpar']}{$math['abs']}$yAyB{$math['abs']}{$math['div']}{$math['abs']}$xAxB{$math['abs']}{$math['rpar']}");
    $yAyBabs = abs($yAyB);
    $xAxBabs = abs($xAxB);
    array_push($step, "{$math['eq']} arctan{$math['lpar']}$yAyBabs{$math['div']}$xAxBabs{$math['rpar']}");
    $yAyBabsxAxBabs = $yAyBabs/$xAxBabs;
    array_push($step, "{$math['eq']} arctan{$math['lpar']}$yAyBabsxAxBabs{$math['rpar']}");
    $atanyAyBabsxAxBabs = atan($yAyBabsxAxBabs);
    array_push($step, "{$math['eq']} 弧度值:{$atanyAyBabsxAxBabs}");
    $ABo = rad2deg($atanyAyBabsxAxBabs);
    array_push($step, "{$math['eq']} 角度值:{$ABo}{$math['o']}");

    //算出结果
    $ends = array();
    array_push($ends, "AB的距离:{$AB}");
    $ABoo = round($ABo,1);
    array_push($ends, "AB的方位角:{$ABoo}{$math['o']}");

    //公式表示
    $home = array();
    array_push($home, "AB的距离:AB{$math['eq']}{$math['root2l']}{$math['abs']}xA{$math['sub']}xB{$math['abs']}{$math['sup2']}{$math['add']}{$math['abs']}yA{$math['sub']}yB{$math['abs']}{$math['sup2']}{$math['root2r']}");
    array_push($home, "AB的方位角:AB{$math['eq']}arctan{$math['lpar']}{$math['abs']}yA{$math['sub']}yB{$math['abs']}{$math['div']}{$math['abs']}xA{$math['sub']}xB{$math['abs']}{$math['rpar']}");

    //解释说明
    $info = array();
    array_push($info, "已知A点坐标,B点坐标,求其之间的长度和方位角;");
    array_push($info, "这种计算在测量中称为坐标反算。");

    know($know);
    ends($ends);
    home($home);
    step($step);
    info($info);
}
?>
<?php include ROOT.'/assets/php/foot.php'; ?>

结果:

☁参考上图[2022-12-05]  

☀求AB距离方位角已知点A点B坐标  
100 80 140 110  
点A的x坐标:100  
点A的y坐标:80  
点B的x坐标:140  
点B的y坐标:110  

♠算出结果  
AB的距离:50.00  
AB的方位角:36.9°  

♦公式表示  
AB的距离:AB=√₍|xA−xB|²+|yA−yB|²₎  
AB的方位角:AB=arctan(|yA−yB|÷|xA−xB|)  

♣计算步骤  
求AB的距离:  
= √₍|100−140|²+|80−110|²₎  
= √₍|-40.00|²+|-30.00|²₎  
= √₍40²+30²₎  
= √₍1600.00+900.00₎  
= √2500.00  
= 50.00  
求AB的方位角:  
= arctan(|80−110|÷|100−140|)  
= arctan(|-30.00|÷|-40.00|)  
= arctan(30÷40)  
= arctan(0.75)  
= 弧度值:0.64350110879328  
= 角度值:36.869897645844°  

♥解释说明  
已知A点坐标,B点坐标,求其之间的长度和方位角;  
这种计算在测量中称为坐标反算。  

标签:110004,AB,arctan,方位角,110,80,坐标
From: https://www.cnblogs.com/onestopweb/p/16951285.html

相关文章