From 39f2114f9797eb51994966c6bb8ff1814c9a4da8 Mon Sep 17 00:00:00 2001 From: Florian Merz Date: Thu, 11 Feb 2021 12:36:08 +0100 Subject: unslug fr: move --- .../reference/global_objects/math/atan2/index.html | 113 +++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 files/fr/web/javascript/reference/global_objects/math/atan2/index.html (limited to 'files/fr/web/javascript/reference/global_objects/math/atan2/index.html') diff --git a/files/fr/web/javascript/reference/global_objects/math/atan2/index.html b/files/fr/web/javascript/reference/global_objects/math/atan2/index.html new file mode 100644 index 0000000000..3c49ff6ba5 --- /dev/null +++ b/files/fr/web/javascript/reference/global_objects/math/atan2/index.html @@ -0,0 +1,113 @@ +--- +title: Math.atan2() +slug: Web/JavaScript/Reference/Objets_globaux/Math/atan2 +tags: + - JavaScript + - Math + - Méthode + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Math/atan2 +--- +
{{JSRef}}
+ +

La fonction Math.atan2() renvoie l'arc tangente du quotient de ses arguments.

+ +
{{EmbedInteractiveExample("pages/js/math-atan2.html")}}
+ + + +

Syntaxe

+ +
Math.atan2(y, x) 
+ +

Paramètres

+ +
+
x
+
La coordonnée en abscisse du point.
+
y
+
La coordonnée en ordonnée du point.
+
+ +

Valeur de retour

+ +

L'arc tangente du quotient formé par les deux arguments, c'est-à-dire l'angle, exprimé en radians entre l'axe des abscisses et la droite passant par l'origin (0,0) et le point de coordonnées (x,y).

+ +

Description

+ +

La méthode Math.atan2() renvoie une valeur numérique comprise entre -Pi et Pi qui représente l'angle theta d'un point de coordonnées (x,y). Cela correspond à l'angle (dans le sens trigonométrique) entre l'axe des abscisses et le point de coordonnées (x,y). Attention, le premier argument de la fonction est l'ordonnée (y) et le second est l'abscisse (x).

+ +

Graphique explicitant l'angle donné par un point de coordonnées X/Y

+ +

Math.atan2() utilise deux arguments x et y, alors que la méthode Math.atan() utilise le ratio de deux nombres comme un seul argument.

+ +

atan2() est une méthode statique de l'objet Math, elle doit toujours être utilisée avec la syntaxe Math.atan2(), elle ne doit pas être utilisée comme la méthode d'un autre objet qui aurait été créé (Math n'est pas un constructeur).

+ +

Exemples

+ +

Utiliser Math.atan2()

+ +
Math.atan2(90, 15); // 1.4056476493802699
+Math.atan2(15, 90); // 0.16514867741462683
+
+Math.atan2( ±0, -0 );               // ±PI.
+Math.atan2( ±0, +0 );               // ±0.
+Math.atan2( ±0, -x );               // ±PI pour x > 0.
+Math.atan2( ±0, x );                // ±0 pour x > 0.
+Math.atan2( -y, ±0 );               // -PI/2 pour y > 0.
+Math.atan2( y, ±0 );                // PI/2 pour y > 0.
+Math.atan2( ±y, -Infinity );        // ±PI pour y qui est un nombre fini > 0.
+Math.atan2( ±y, +Infinity );        // ±0 pour y qui est un nombre fini > 0.
+Math.atan2( ±Infinity, x );         // ±PI/2 pour x qui est un nombre fini.
+Math.atan2( ±Infinity, -Infinity ); // ±3*PI/4.
+Math.atan2( ±Infinity, +Infinity ); // ±PI/4.
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES1')}}{{Spec2('ES1')}}Définition initiale. Implémentée avec JavaScript 1.0.
{{SpecName('ES5.1', '#sec-15.8.2.5', 'Math.atan2')}}{{Spec2('ES5.1')}} 
{{SpecName('ES6', '#sec-math.atan2', 'Math.atan2')}}{{Spec2('ES6')}} 
{{SpecName('ESDraft', '#sec-math.atan2', 'Math.atan2')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("javascript.builtins.Math.atan2")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf