#!/usr/bin/perl

#############################################
# 三角関数のサンプル3
# Author: "Perl Programming Tips"
#############################################

use Math::Trig;

# 度からラジアンに変換
print "180[deg] = " . deg2rad(180) . "[rad]\n";

# 度からグラジアンに変換
print "180[deg] = " . deg2grad(180) . "[grad]\n";

# グラジアンから度に変換
print "300[grad] = " . grad2deg(300) . "[deg]\n";

# グラジアンからラジアンに変換
print "200[grad] = " . grad2rad(200) . "[rad]\n";

# ラジアンから度に変換
print "3pi[rad] = " . rad2deg(pi *3) . "[deg]\n";

# ラジアンからグラジアンに変換
print "3pi[rad] = " . rad2grad(pi *3) . "[grad]\n";

#風向から「u」変換
print "u=sin(deg2rad(45)) " . sin(deg2rad(45)) . " \n";

#風向から「v」変換
print "v=cos(deg2rad(45)) " . cos(deg2rad(45)) . " \n";

#「u」・「v」を風向に変換
print "風向（角度）=atan2(0.052754,-0.99861)*180/pi() " . atan2(0.052754,-0.99861)*180/pi() . " \n";
print "風向（角度）=rad2deg(atan2(43.05272,-36.7277)) " . rad2deg(atan2(43.05272,-36.7277)). " \n";
print "風向（角度）=rad2deg(atan2(-17.5994,53.11435)) " . rad2deg(atan2(-17.5994,53.11435)). " \n";

