직각삼각형 빗변길이, 각도 구하기 php 함수 > PHP 프로그래밍

본문 바로가기

PHP 프로그래밍

PHP 프로그래밍

1. 직각삼각형 빗변길이, 각도 구하기 php 함수

페이지 정보

작성자 관리자 댓글 1건 조회 8,610회 작성일 20-02-01 04:26

본문

1. 직각삼각형 빗변길이, 각도 구하기 php 함수

밑변 : x, 높이 : y 인 삼각형

 

문제 1: x 와 y 의 길이만 알고 있는 직각삼각형의

① 빗변의 길이와

② 각도 a를 구하라.

 


① 빗변의 길이

방법 A: $z = sqrt( pow( $x, 2 ) + pow( $y, 2 ) );

방법 B: $z = sqrt( $x*$x + $y*$y );

방법 C: $z = hypot( $x, $y );

 


pow 함수: http://kr.php.net/manual/en/function.pow.php

sqrt 함수: http://kr.php.net/manual/en/function.sqrt.php

hypot 함수: http://kr.php.net/manual/en/function.hypot.php

 


② 각도 a

$a = rad2deg( atan2( $x, $y ) );

 


atan2 함수: http://kr.php.net/manual/en/function.atan2.php

rad2deg 함수: http://kr.php.net/manual/en/function.rad2deg.php 


Copyright © LEELAB.CO.KR. All rights reserved.