# 일반적인 수학 함수 사용

> Use Unity's Mathf class to apply trigonometric, logarithmic, and other math functions commonly required in game development.

Unity의 Mathf 클래스는 게임 및 앱 개발에 일반적으로 필요한 삼각 함수, 로그 함수, 기타 함수를 비롯한 일반적인 수학 함수 컬렉션을 제공합니다.

이 페이지에서는 Mathf 클래스와 스크립팅 시 자주 사용되는 클래스에 대한 개요를 제공합니다. Mathf 클래스의 모든 멤버에 대한 전체 레퍼런스는 [Mathf 스크립트 레퍼런스](/engine/6000.0/script-reference/unity-engine/mathf.md)를 참조하십시오.

## 삼각 함수

Unity의 모든 삼각 함수는 **라디안**을 사용합니다.

* [`Sin`](/engine/6000.0/script-reference/unity-engine/mathf/sin.md)
* [`Cos`](/engine/6000.0/script-reference/unity-engine/mathf/cos.md)
* [`Tan`](/engine/6000.0/script-reference/unity-engine/mathf/tan.md)
* [`Asin`](/engine/6000.0/script-reference/unity-engine/mathf/asin.md)
* [`Acos`](/engine/6000.0/script-reference/unity-engine/mathf/acos.md)
* [`Atan`](/engine/6000.0/script-reference/unity-engine/mathf/atan.md)
* [`Atan2`](/engine/6000.0/script-reference/unity-engine/mathf/atan-2.md)

[`PI`](/engine/6000.0/script-reference/unity-engine/mathf/pi.md)은 상수로 사용할 수 있으며, 정적 값 [`Rad2Deg`](/engine/6000.0/script-reference/unity-engine/mathf/rad-2-deg.md) 또는 [`Deg2Rad`](/engine/6000.0/script-reference/unity-engine/mathf/deg-2-rad.md)을 곱하여 라디안과 일반 각도를 서로 변환할 수 있습니다.

## 거듭제곱근 및 제곱근

Unity는 다음과 같은 일반적인 거듭제곱근 및 제곱근을 제공합니다.

* [`Pow`](/engine/6000.0/script-reference/unity-engine/mathf/pow.md)
* [`Sqrt`](/engine/6000.0/script-reference/unity-engine/mathf/sqrt.md)
* [`Exp`](/engine/6000.0/script-reference/unity-engine/mathf/exp.md)

몇 가지 유용한 2의 거듭제곱과 관련된 함수도 있습니다. 다음 함수는 종종 2의 거듭제곱 값(예: 텍스처 차원)으로 제한되거나 최적화되는 일반적인 바이너리 데이터 크기로 작업할 때 유용합니다.

* [`ClosestPowerOfTwo`](/engine/6000.0/script-reference/unity-engine/mathf/closest-power-of-two.md)
* [`NextPowerOfTwo`](/engine/6000.0/script-reference/unity-engine/mathf/next-power-of-two.md)
* [`IsPowerOfTwo`](/engine/6000.0/script-reference/unity-engine/mathf/is-power-of-two.md)

## 보간

Unity의 보간 함수를 사용하면 주어진 두 지점 사이에 있는 값을 계산할 수 있습니다. 아래의 각 함수는 서로 다른 방식으로 작동하며 각기 다른 상황에 적합합니다. 자세한 내용은 각 예시를 참조하십시오.

* [`Lerp`](/engine/6000.0/script-reference/unity-engine/mathf/lerp.md)
* [`LerpAngle`](/engine/6000.0/script-reference/unity-engine/mathf/lerp-angle.md)
* [`LerpUnclamped`](/engine/6000.0/script-reference/unity-engine/mathf/lerp-unclamped.md)
* [`InverseLerp`](/engine/6000.0/script-reference/unity-engine/mathf/inverse-lerp.md)
* [`MoveTowards`](/engine/6000.0/script-reference/unity-engine/mathf/move-towards.md)
* [`MoveTowardsAngle`](/engine/6000.0/script-reference/unity-engine/mathf/move-towards-angle.md)
* [`SmoothDamp`](/engine/6000.0/script-reference/unity-engine/mathf/smooth-damp.md)
* [`SmoothDampAngle`](/engine/6000.0/script-reference/unity-engine/mathf/smooth-damp-angle.md)
* [`SmoothStep`](/engine/6000.0/script-reference/unity-engine/mathf/smooth-step.md)

[Vector classes](/engine/6000.0/manual/scripting/object-oriented-development/vectors.md) 및 [`Quaternion`](/engine/6000.0/manual/scripting/object-oriented-development/class-quaternion.md) 클래스는 모두 여러 차원의 위치, 방향 및 회전을 보간할 수 있는 자체 보간 함수(예: Quaternion.Lerp)를 보유하고 있습니다.

## 값 제한 및 반복

이러한 간단한 헬퍼 함수는 게임이나 앱에서 유용하게 사용되며, 값을 특정 범위로 제한하거나 특정 범위 내에서 반복해야 할 때 시간을 절약할 수 있습니다.

* [`Max`](/engine/6000.0/script-reference/unity-engine/mathf/max.md) 및 [`Min`](/engine/6000.0/script-reference/unity-engine/mathf/min.md)
* [`Repeat`](/engine/6000.0/script-reference/unity-engine/mathf/repeat.md) 및 [`PingPong`](/engine/6000.0/script-reference/unity-engine/mathf/ping-pong.md)
* [`Clamp`](/engine/6000.0/script-reference/unity-engine/mathf/clamp.md) 및 [`Clamp01`](/engine/6000.0/script-reference/unity-engine/mathf/clamp-01.md)
* [`Ceil`](/engine/6000.0/script-reference/unity-engine/mathf/ceil.md) 및 [`Floor`](/engine/6000.0/script-reference/unity-engine/mathf/floor.md)

## 로그 함수

[`Log`](/engine/6000.0/script-reference/unity-engine/mathf/log.md) 함수를 사용하면 지정된 숫자의 로그값(자연로그 또는 지정된 밑을 사용)을 계산할 수 있습니다. 또한 [`Log10`](/engine/6000.0/script-reference/unity-engine/mathf/log-10.md) 함수는 지정된 숫자의 밑이 10인 로그값을 반환합니다.

## 기타 함수

Mathf 클래스에 속하는 모든 함수의 목록은 [Mathf 스크립트 레퍼런스](/engine/6000.0/script-reference/unity-engine/mathf.md)에서 확인하십시오.
