Math.Atan2 メソッドとは? わかりやすく解説

Math.Atan2 メソッド

タンジェント2 つ指定された数の商である角度返します

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Shared Function Atan2
 ( _
    y As Double, _
    x As Double _
) As Double

パラメータ

y

点の y 座標

x

点の x 座標

戻り値
π θ π および tan(θ) = y / xラジアン示した角度 θ。(x, y) は、デカルト座標の点を示します次の点に注意してください

  • クワドラント 1 の (x, y) の場合は、0 < θ < π/2。

  • クワドラント 2 の (x, y) の場合は、π/2 < θπ

  • クワドラント 3 の (x, y) の場合は、-π < θ < -π/2。

  • クワドラント 4 の (x, y) の場合は、-π/2 < θ < 0。

解説解説

戻り値は、デカルト座標x 軸と、原点 (0,0) から始まり点 (x,y) で終了するベクタによって構成される角度です。

使用例使用例
' This example demonstrates Math.Atan()
'                           Math.Atan2()
'                           Math.Tan()
Imports System

Class Sample
   Public Shared Sub Main()
      Dim x As Double =
 1.0
      Dim y As Double =
 2.0
      Dim angle As Double
      Dim radians As Double
      Dim result As Double
      
      ' Calculate the tangent of 30 degrees.
      angle = 30
      radians = angle *(Math.PI / 180)
      result = Math.Tan(radians)
      Console.WriteLine("The tangent of 30 degrees is {0}.",
 result)
      
      ' Calculate the arctangent of the previous tangent.
      radians = Math.Atan(result)
      angle = radians *(180 / Math.PI)
      Console.WriteLine("The previous tangent is equivalent to
 {0} degrees.", angle)
      
      ' Calculate the arctangent of an angle.
      Dim line1 As [String] = "{0}The
 arctangent of the angle formed by the x-axis and "
      Dim line2 As [String] = "a
 vector to point ({0},{1}) is {2}, "
      Dim line3 As [String] = "which
 is equivalent to {0} degrees."
      
      radians = Math.Atan2(y, x)
      angle = radians *(180 / Math.PI)
      
      Console.WriteLine(line1, Environment.NewLine)
      Console.WriteLine(line2, x, y, radians)
      Console.WriteLine(line3, angle)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'The tangent of 30 degrees is 0.577350269189626.
'The previous tangent is equivalent to 30 degrees.
'
'The arctangent of the angle formed by the x-axis and
'a vector to point (1,2) is 1.10714871779409,
'which is equivalent to 63.434948822922 degrees.
'
// This example demonstrates Math.Atan()
//                           Math.Atan2()
//                           Math.Tan()
using System;

class Sample 
{
    public static void Main()
 
    {
    double x = 1.0;
    double y = 2.0;
    double angle;
    double radians;
    double result;

// Calculate the tangent of 30 degrees.
    angle = 30;
    radians = angle * (Math.PI/180);
    result = Math.Tan(radians);
    Console.WriteLine("The tangent of 30 degrees is {0}.", result);

// Calculate the arctangent of the previous tangent.
    radians = Math.Atan(result);
    angle = radians * (180/Math.PI);
    Console.WriteLine("The previous tangent is equivalent to {0} degrees.",
 angle);

// Calculate the arctangent of an angle.
    String line1 = "{0}The arctangent of the angle formed by the x-axis and
 ";
    String line2 = "a vector to point ({0},{1}) is {2}, ";
    String line3 = "which is equivalent to {0} degrees.";

    radians = Math.Atan2(y, x);
    angle = radians * (180/Math.PI);

    Console.WriteLine(line1, Environment.NewLine);
    Console.WriteLine(line2, x, y, radians);
    Console.WriteLine(line3, angle);
    }
}
/*
This example produces the following results:

The tangent of 30 degrees is 0.577350269189626.
The previous tangent is equivalent to 30 degrees.

The arctangent of the angle formed by the x-axis and
a vector to point (1,2) is 1.10714871779409,
which is equivalent to 63.434948822922 degrees.
*/
// This example demonstrates Math.Atan()
//                           Math.Atan2()
//                           Math.Tan()
using namespace System;
int main()
{
   double x = 1.0;
   double y = 2.0;
   double angle;
   double radians;
   double result;
   
   // Calculate the tangent of 30 degrees.
   angle = 30;
   radians = angle * (Math::PI / 180);
   result = Math::Tan( radians );
   Console::WriteLine( "The tangent of 30 degrees is {0}.", result );
   
   // Calculate the arctangent of the previous tangent.
   radians = Math::Atan( result );
   angle = radians * (180 / Math::PI);
   Console::WriteLine( "The previous tangent is equivalent to {0} degrees.",
 angle );
   
   // Calculate the arctangent of an angle.
   String^ line1 = "{0}The arctangent of the angle formed by the x-axis and
 ";
   String^ line2 = "a vector to point ({0},{1}) is {2}, ";
   String^ line3 = "which is equivalent to {0} degrees.";
   radians = Math::Atan2( y, x );
   angle = radians * (180 / Math::PI);
   Console::WriteLine( line1, Environment::NewLine );
   Console::WriteLine( line2, x, y, radians );
   Console::WriteLine( line3, angle );
}

/*
This example produces the following results:

The tangent of 30 degrees is 0.577350269189626.
The previous tangent is equivalent to 30 degrees.

The arctangent of the angle formed by the x-axis and
a vector to point (1,2) is 1.10714871779409,
which is equivalent to 63.434948822922 degrees.
*/
// This example demonstrates Math.Atan()
//                           Math.Atan2()
//                           Math.Tan()

import System.*;

class Sample
{
    public static void main(String[]
 args)
    {
        double x = 1.0;
        double y = 2.0;
        double angle;
        double radians;
        double result;

        // Calculate the tangent of 30 degrees.
        angle = 30;
        radians = angle * (Math.PI / 180);
        result = System.Math.Tan(radians);
        Console.WriteLine("The tangent of 30 degrees is {0}.", 
            System.Convert.ToString(result));

        // Calculate the arctangent of the previous tangent.
        radians = System.Math.Atan(result);
        angle = radians * (180 / Math.PI);
        Console.WriteLine("The previous tangent is equivalent to {0} degrees."
,
            System.Convert.ToString(angle));

        // Calculate the arctangent of an angle.
        String line1 = "{0}The arctangent of the angle formed by"
            + " the x-axis and ";
        String line2 = "a vector to point ({0},{1}) is {2}, ";
        String line3 = "which is equivalent to {0} degrees.";

        radians = System.Math.Atan2(y, x);
        angle = radians * (180 / Math.PI);

        Console.WriteLine(line1, Environment.get_NewLine());
        Console.WriteLine(line2, System.Convert.ToString(x), 
            System.Convert.ToString(y), System.Convert.ToString(radians));
        Console.WriteLine(line3, System.Convert.ToString(angle));
    } //main
} //Sample

/*
This example produces the following results:

The tangent of 30 degrees is 0.577350269189626.
The previous tangent is equivalent to 30 degrees.

The arctangent of the angle formed by the x-axis and
a vector to point (1,2) is 1.10714871779409,
which is equivalent to 63.434948822922 degrees.
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からMath.Atan2 メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からMath.Atan2 メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からMath.Atan2 メソッドを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Math.Atan2 メソッド」の関連用語

Math.Atan2 メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Math.Atan2 メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS