首页 > 其他分享 >110002 求最短距离和ABDE四角已知两点坐标

110002 求最短距离和ABDE四角已知两点坐标

时间:2022-12-04 21:58:31浏览次数:53  
标签:直角三角形 110002 30 40 arctan ABDE 短距离 90

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

$tit= '求最短距离和ABDE四角已知两点坐标';
//已知x1:100,y1:80,x2:140,y2: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);
    $x1 = evev($vals[0]);
    $y1 = evev($vals[1]);
    $x2 = evev($vals[2]);
    $y2 = evev($vals[3]);

    //已知条件
    $know = array();
    array_push($know, $val);
    $v0 = eveq($vals[0]);
    array_push($know, "x1:$v0");
    $v1 = eveq($vals[1]);
    array_push($know, "y1:$v1");
    $v2 = eveq($vals[2]);
    array_push($know, "x2:$v2");
    $v3 = eveq($vals[3]);
    array_push($know, "y2:$v3");

    //计算步骤
    $step = array();
    array_push($step, "两点间距离公式:");
    array_push($step, "{$math['eq']} {$math['root2l']}{$math['abs']}$x1{$math['sub']}$x2{$math['abs']}{$math['sup2']}{$math['add']}{$math['abs']}$y1{$math['sub']}$y2{$math['abs']}{$math['sup2']}{$math['root2r']}");
    $x1x2 = bcsub($x1, $x2);
    $y1y2 = bcsub($y1, $y2);
    array_push($step, "{$math['eq']} {$math['root2l']}{$math['abs']}$x1x2{$math['abs']}{$math['sup2']}{$math['add']}{$math['abs']}$y1y2{$math['abs']}{$math['sup2']}{$math['root2r']}");
    $x1x2abs = abs($x1x2);
    $y1y2abs = abs($y1y2);
    array_push($step, "{$math['eq']} {$math['root2l']}$x1x2abs{$math['sup2']}{$math['add']}$y1y2abs{$math['sup2']}{$math['root2r']}");
    $x1x2abs2 = bcpow($x1x2abs, 2);
    $y1y2abs2 = bcpow($y1y2abs, 2);
    array_push($step, "{$math['eq']} {$math['root2l']}$x1x2abs2{$math['add']}$y1y2abs2{$math['root2r']}");
    $x1x2abs2y1y2abs2 = bcadd($x1x2abs2, $y1y2abs2);
    array_push($step, "{$math['eq']} {$math['root2']}$x1x2abs2y1y2abs2");
    $AB = bcsqrt($x1x2abs2y1y2abs2);
    array_push($step, "{$math['eq']} $AB");

    $b = $x1x2abs;
    $a = $y1y2abs;
    $c = $AB;

    array_push($step, "求直角三角形的{$math['ang']}A:");
    array_push($step, "{$math['eq']} arctan{$math['lpar']}$a{$math['div']}$b{$math['rpar']}");
    $ab = $a/$b;
    array_push($step, "{$math['eq']} arctan{$math['lpar']}$ab{$math['rpar']}");
    $atanab = atan($ab);
    array_push($step, "{$math['eq']} 弧度值:{$atanab}");
    $ao = rad2deg($atanab);
    array_push($step, "{$math['eq']} 角度值:{$ao}{$math['o']}");

    array_push($step, "求直角三角形的{$math['ang']}B:");
    array_push($step, "{$math['eq']} arctan{$math['lpar']}$b{$math['div']}$a{$math['rpar']}");
    $ba = $b/$a;
    array_push($step, "{$math['eq']} arctan{$math['lpar']}$ba{$math['rpar']}");
    $atanba = atan($ba);
    array_push($step, "{$math['eq']} 弧度值:{$atanba}");
    $bo = rad2deg($atanba);
    array_push($step, "{$math['eq']} 角度值:{$bo}{$math['o']}");

    array_push($step, "求直角三角形的{$math['ang']}D:");    
    array_push($step, "{$math['eq']} 90{$math['o']}{$math['sub']}{$ao}{$math['o']}");
    $do = 90-$ao;
    array_push($step, "{$math['eq']} {$do}{$math['o']}");

    array_push($step, "求直角三角形的{$math['ang']}E:");    
    array_push($step, "{$math['eq']} 90{$math['o']}{$math['sub']}{$bo}{$math['o']}");
    $eo = 90-$bo;
    array_push($step, "{$math['eq']} {$eo}{$math['o']}");

    //算出结果
    $ends = array();
    array_push($ends, "最短距离:$AB");
    array_push($ends, "直角三角形的a边:{$a}");
    array_push($ends, "直角三角形的b边:{$b}");
    array_push($ends, "直角三角形的c边:{$c}");
    $aoo = round($ao,1);
    $boo = round($bo,1);
    $coo = round($co,1);
    $doo = round($do,1);
    $eoo = round($eo,1);
    array_push($ends, "直角三角形的{$math['ang']}A:{$aoo}{$math['o']}");
    array_push($ends, "直角三角形的{$math['ang']}B:{$boo}{$math['o']}");
    array_push($ends, "直角三角形的{$math['ang']}C:90{$math['o']}");
    array_push($ends, "直角三角形的{$math['ang']}D:{$doo}{$math['o']}");
    array_push($ends, "直角三角形的{$math['ang']}E:{$eoo}{$math['o']}");

    //公式表示
    $home = array();
    array_push($home, "两点间距离公式:AB{$math['eq']}{$math['root2l']}{$math['abs']}x1{$math['sub']}x2{$math['abs']}{$math['sup2']}{$math['add']}{$math['abs']}y1{$math['sub']}y2{$math['abs']}{$math['sup2']}{$math['root2r']}");
    array_push($home, "直角三角形的{$math['ang']}A:{$math['ang']}A{$math['eq']}arctan{$math['lpar']}a{$math['div']}b{$math['rpar']}");
    array_push($home, "直角三角形的{$math['ang']}B:{$math['ang']}B{$math['eq']}arctan{$math['lpar']}b{$math['div']}a{$math['rpar']}");
    array_push($home, "直角三角形的{$math['ang']}D:90{$math['o']}{$math['sub']}{$math['ang']}A");
    array_push($home, "直角三角形的{$math['ang']}E:90{$math['o']}{$math['sub']}{$math['ang']}B");

    //公式说明
    $info = array();
    array_push($info, "两点间距离公式: 最短距离 {$math['eq']} 平方根 {$math['lpar']} {$math['abs']}X1{$math['sub']}X2{$math['abs']}的平方 {$math['add']}{$math['abs']}Y1{$math['sub']}Y2{$math['abs']}的平方 {$math['rpar']}。");
    array_push($info, "其中{$math['ang']}D是坐标的方位角。");

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

结果:

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

☀求最短距离和ABDE四角已知两点坐标  
100 80 140 110  
x1:100  
y1:80  
x2:140  
y2:110  

♠算出结果  
最短距离:50.00  
直角三角形的a边:30  
直角三角形的b边:40  
直角三角形的c边:50.00  
直角三角形的∠A:36.9°  
直角三角形的∠B:53.1°  
直角三角形的∠C:90°  
直角三角形的∠D:53.1°  
直角三角形的∠E:36.9°  

♦公式表示  
两点间距离公式:AB=√₍|x1−x2|²+|y1−y2|²₎  
直角三角形的∠A:∠A=arctan(a÷b)  
直角三角形的∠B:∠B=arctan(b÷a)  
直角三角形的∠D:90°−∠A  
直角三角形的∠E:90°−∠B  

♣计算步骤  
两点间距离公式:  
= √₍|100−140|²+|80−110|²₎  
= √₍|-40.00|²+|-30.00|²₎  
= √₍40²+30²₎  
= √₍1600.00+900.00₎  
= √2500.00  
= 50.00  
求直角三角形的∠A:  
= arctan(30÷40)  
= arctan(0.75)  
= 弧度值:0.64350110879328  
= 角度值:36.869897645844°  
求直角三角形的∠B:  
= arctan(40÷30)  
= arctan(1.3333333333333)  
= 弧度值:0.92729521800161  
= 角度值:53.130102354156°  
求直角三角形的∠D:  
= 90°−36.869897645844°  
= 53.130102354156°  
求直角三角形的∠E:  
= 90°−53.130102354156°  
= 36.869897645844°  

♥解释说明  
两点间距离公式: 最短距离 = 平方根 ( |X1−X2|的平方 +|Y1−Y2|的平方 )。  
其中∠D是坐标的方位角。  

标签:直角三角形,110002,30,40,arctan,ABDE,短距离,90
From: https://www.cnblogs.com/onestopweb/p/16950910.html

相关文章

  • 110001 求最短距离已知两点坐标
    <?phpheader('Content-Type:text/html;charset=utf-8');define('ROOT',$_SERVER['DOCUMENT_ROOT']);includeROOT.'/assets/php/head.php';$tit='求最短距离已知......
  • 2022河南萌新联赛第(一)场:ABDEFK
    https://ac.nowcoder.com/acm/contest/37160#questionanti-Nim游戏(反Nim游戏/反尼姆博弈问题)定义游戏规则与Nim类似,只是最后把石子取完的人输。结论先手必胜的条件为......
  • java-floyd最短距离算法
    java-floyd最短距离算法publicstaticvoidmain(String[]args){MatrixDGmatrixDG=newMatrixDG();System.out.println("初始化邻接矩阵");matrixDG.print......