atan2
이 페이지에서

atan2()

함수, 내장 함수 분류

atan2(y, x): two-argument arctangent, resolving the full angle in [-π, π] from a (y, x) pair.

import { atan2 } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

function atan2<K extends FloatKey>(y: ReadonlyNode<K>, x: NoInfer<ArithArg<K>>): Node<K>;
function atan2(y: number, x: ReadonlyNode<'f32'>): Node<'f32'>;

매개변수

y ReadonlyNode<K>
x NoInfer<ArithArg<K>>

반환값

Node<K>

설명

Use it over the single-argument atan whenever the sign of x carries quadrant information, as when recovering a heading from a 2-D offset. Spelled atan2 on WGSL and as the two-argument atan(y, x) on GLSL.

예제

예제

import { fn, atan2, f32T } from 'typeshade'
const heading = fn('heading', { dy: f32T, dx: f32T }, ({ dy, dx }) => atan2(dy, dx))

대상별 지원

대상지원비고
WGSL (WebGPU) 지원

atan2(y, x).

GLSL ES 3.00 (WebGL2) 지원

atan(y, x).

CPU 오라클 지원

Evaluated in f64 by the oracle.

관련 가이드

함께 보기

소스

src/core/ir/node.ts, 1612행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고