中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

JavaScript atan2() 方法

Math 對(duì)象參考手冊(cè) JavaScript Math 對(duì)象

實(shí)例

實(shí)例 1 - atan2(y,x)

指定一個(gè)坐標(biāo)(x,y),坐標(biāo)值(4,8),使用 atan2() 方法計(jì)算坐標(biāo)與 X 軸之間的角度的弧度 ,如下實(shí)例:

Math.atan2(8,4);

以上實(shí)例輸出:

1.1071487177940904


運(yùn)行代碼 ?


定義和用法

atan2() 返回從原點(diǎn)(0,0) 到 (x,y) 點(diǎn)的線段與 x 軸正方向之間的平面角度(弧度值),也就是 Math.atan2(y,x)

注意: atan2()有兩個(gè)參數(shù), y 坐標(biāo)是作為第一個(gè)參數(shù)傳遞, x 坐標(biāo)作為第二個(gè)參數(shù)傳遞。


瀏覽器支持

Internet ExplorerFirefoxOperaGoogle ChromeSafari

所有主要瀏覽器都支持 atan2() 方法


語(yǔ)法

Math.atan2(y,x)
參數(shù) 描述
y 必須。一個(gè)數(shù)字代表Y坐標(biāo)
x 必須。 一個(gè)數(shù)字代表x坐標(biāo)

返回值

類型 描述
Number x 的反正切值。返回一個(gè) -PI 到 PI 之間的數(shù)值。表示點(diǎn) (x, y) 對(duì)應(yīng)的偏移角度。這是一個(gè)逆時(shí)針角度,以弧度為單位,正X軸和點(diǎn) (x, y) 與原點(diǎn)連線 之間。注意此函數(shù)接受的參數(shù):先傳遞 y 坐標(biāo),然后是 x 坐標(biāo)。

技術(shù)細(xì)節(jié)

JavaScript 版本: 1.0

更多實(shí)例

實(shí)例

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 for x > 0.
Math.atan2( ±0, x ) ? ? ? ? ? ? ? ?// ±0 for x > 0.
Math.atan2( -y, ±0 ) ? ? ? ? ? ? ? // -PI/2 for y > 0.
Math.atan2( y, ±0 ) ? ? ? ? ? ? ? ?// PI/2 for y > 0.
Math.atan2( ±y, -Infinity ) ? ? ? ?// ±PI for finite y > 0.
Math.atan2( ±y, +Infinity ) ? ? ? ?// ±0 for finite y > 0.
Math.atan2( ±Infinity, x ) ? ? ? ? // ±PI/2 for finite x.
Math.atan2( ±Infinity, -Infinity ) // ±3*PI/4.
Math.atan2( ±Infinity, +Infinity ) // ±PI/4.

Math 對(duì)象參考手冊(cè) JavaScript Math 對(duì)象

其他擴(kuò)展