> For the complete documentation index, see [llms.txt](https://lee-seokhyun.gitbook.io/game-programming/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lee-seokhyun.gitbook.io/game-programming/client/easy-mathematics/gdc2012/interpolation.md).

# 보간(Interpolation)

### 보간(Interpolation)

보간이란 시간이 지남에 따라 혼합될 가중치의 양을 변화시키는것을 의미합니다. Lerping이라고도 부릅니다. 즉, 손잡이를 돌릴 때 해당 위치로 점프하는것이 아니라 서서히 돌리는것을 말합니다.

![](/files/-Lonjcibe_QCZoxjVJNk)

게임 프로그래밍에서는 일반적으로 매 프레임 호출되는 Update매소드가 존재하는데 이 매소드 안에서 어떻게 보간을 할지 결정하는 코드가 들어가게 됩니다. 예를들면 몬스터가 A지점에서 B지점으로 이동하는 경우를 들 수 있죠. 이런 코드들은 보통 두가지 방법으로 구현할 수 있습니다.

\#1. 시작점과 목적지사이의 좌표를 시간에 따라 계산하는 방식\
(매개변수 평가 방법)

\#2. 목적지를 향해 현재 좌표에 속도를 더하는 방식\
(수치 적분 방법)

게임 프로그래밍에서는 두 가지 방식을 모두 사용합니다. 대부분의 물리엔진에서는 2번 수치적분 방식을 주로 사용하는 경향이 있습니다. 반면에 다른 시스템등에서는 1번 방식을 많이 씁니다. 물론 상황에 따라 다르기 때문에 꼭 이렇게 써야하는건 아닙니다.

보간의 예) 오디오 크로스 페이드 효과

![](/files/-LonkAhmir4CQ5nSNv3u)

다시 말하면 시간의 흐름에 따라 혼합되는 모든 종류의 작업을 **보간**(Lerping) 이라고 합니다.

{% hint style="info" %}
역주) 좀 더 자세히 설명해 드리면 Lerp = Linear Interpolation 이라고 해서 선형 보간을 뜻합니다. 선형이란 속도가 일정하다고 이해하면 되므로 일정한 속도로 A -> B로 이동한다라는 개념인 것이죠. 여기서 A와 B는 좌표 일 수도 있고, 스케일, 색상값등등 수치로 표현할 수 있다면 어떠한 형식도 올 수 있습니다.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lee-seokhyun.gitbook.io/game-programming/client/easy-mathematics/gdc2012/interpolation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
