---
title: "sin 과 cos 는 무엇인가: 비스듬한 화살표를 가로와 세로로 나누기"
description: "대포를 30도로 쏠 때 앞으로 얼마, 위로 얼마 가는지 구하는 도구가 cos 와 sin 입니다. 직각삼각형에서 가로 ÷ 빗변 이 cos, 세로 ÷ 빗변 이 sin 이고, 길이 1 인 원 위의 점이 (cos, sin) 입니다. 유니티의 Mathf.Sin 이 도가 아닌 라디안을 받는 이유까지 수학을 처음부터 따라갑니다."
author: "유니얼"
pubDate: 2026-11-05
category: "game-dev/math"
tags: ["Unity", "기초"]
canonical: https://blog.unialgames.com/posts/math-sin-cos/
---
대포를 비스듬히 30° 위로 쏘고, 포탄이 1초에 10 만큼 날아가게 하고 싶습니다.
그런데 유니티의 속도는 각도와 길이로 넣는 것이 아니라 **(앞으로 얼마, 위로 얼마)** 두 숫자로 넣어야 합니다.
10 을 앞과 위로 어떻게 나눠야 할까요. 반반씩 5 와 5 로 나누면 45° 로, 그것도 7.07 의 빠르기로 날아갑니다.

**비스듬한 화살표를 가로와 세로로 나누는 도구가 cos 와 sin** 입니다. 각도만 알면 가로와 세로가 길이의 몇 배인지가 정해지고, 그 두 배수가 cos 와 sin 입니다.

> **직각삼각형에서 cos θ = 가로 ÷ 빗변, sin θ = 세로 ÷ 빗변 입니다. 삼각형 크기와 상관없이 각도 θ 만으로 정해집니다.
> 그래서 가로 = 길이 × cos θ, 세로 = 길이 × sin θ 입니다. 30° 로 10 이면 가로 8.66, 세로 5 입니다.
> 길이를 1 로 두면 화살표 끝은 반지름 1 인 원 위를 돌고, 그 점이 늘 (cos θ, sin θ) 입니다.**

## 화살표 끝에서 수직선을 내리면 직각삼각형

**각도**는 두 선이 벌어진 정도이고, 한 바퀴를 360 칸으로 나눈 **도(°)** 로 셉니다. 바닥과 기둥처럼 똑바로 선 90° 를 **직각**이라고 부릅니다.
비스듬한 화살표 하나가 있으면, 그 끝에서 바닥으로 수직선을 내리기만 해도 세 각 중 하나가 직각인 **직각삼각형**이 생깁니다.

직각 맞은편의 비스듬한 변을 **빗변**이라고 부르고, 세 변 중 가장 깁니다. 여기서는 화살표가 빗변입니다.
직각을 낀 나머지 두 변은 이 글에서 **가로**(바닥에 생긴 변)와 **세로**(내린 수직선)라고 부릅니다.
가로는 "옆으로 얼마 갔나", 세로는 "위로 얼마 갔나" 입니다. 화살표를 가로와 세로로 나누는 일이 곧 이 삼각형의 두 변 길이를 구하는 일입니다.

## 막대를 세우면 가로는 줄고 세로는 는다

길이 1 인 막대를 바닥에 눕힌 0° 에서 똑바로 선 90° 까지 세웠습니다.

<x-vec>
<script type="application/json">
{
 "label": "길이 1 인 막대를 세워 가기",
 "view": [
  -0.4,
  -0.35,
  1.5,
  1.25
 ],
 "steps": [
  {
   "caption": "막대를 바닥에 눕혔습니다. 각도 0°. 막대 끝은 오른쪽으로 1, 위로 0 에 있습니다. 가로가 막대 길이 전부입니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      1.0,
      0.0
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 1",
     "labelAt": [
      0.5,
      0.14
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1.0,
      0
     ],
     "color": "accent2",
     "label": "가로 1",
     "labelAt": [
      0.5,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      1.0,
      0
     ],
     "to": [
      1.0,
      0.0
     ],
     "color": "warn",
     "label": "세로 0",
     "labelAt": [
      1.3,
      0.0
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.2,
      0.12
     ],
     "color": "text",
     "label": "0°"
    }
   ]
  },
  {
   "caption": "30° 세웠습니다. 막대 끝에서 바닥으로 수직선을 내리면 직각삼각형이 생깁니다. 가로 0.87, 세로 0.5.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.87,
      0.5
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 1",
     "labelAt": [
      0.38,
      0.39
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.87,
      0
     ],
     "color": "accent2",
     "label": "가로 0.87",
     "labelAt": [
      0.43,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.87,
      0
     ],
     "to": [
      0.87,
      0.5
     ],
     "color": "warn",
     "label": "세로 0.5",
     "labelAt": [
      1.17,
      0.25
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.26,
      0.08
     ],
     "color": "text",
     "label": "30°"
    }
   ]
  },
  {
   "caption": "45°. 가로와 세로가 0.71 로 같아졌습니다. 딱 절반만큼 세운 각도라 둘이 같습니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.71,
      0.71
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 1",
     "labelAt": [
      0.27,
      0.49
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.71,
      0
     ],
     "color": "accent2",
     "label": "가로 0.71",
     "labelAt": [
      0.35,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.71,
      0
     ],
     "to": [
      0.71,
      0.71
     ],
     "color": "warn",
     "label": "세로 0.71",
     "labelAt": [
      1.01,
      0.35
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.25,
      0.1
     ],
     "color": "text",
     "label": "45°"
    }
   ]
  },
  {
   "caption": "60°. 가로 0.5, 세로 0.87. 30° 일 때의 두 값이 자리를 바꿨습니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.5,
      0.87
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 1",
     "labelAt": [
      0.15,
      0.57
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.5,
      0
     ],
     "color": "accent2",
     "label": "가로 0.5",
     "labelAt": [
      0.25,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.5,
      0
     ],
     "to": [
      0.5,
      0.87
     ],
     "color": "warn",
     "label": "세로 0.87",
     "labelAt": [
      0.8,
      0.43
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.24,
      0.13
     ],
     "color": "text",
     "label": "60°"
    }
   ]
  },
  {
   "caption": "90°. 똑바로 섰습니다. 가로 0, 세로 1. 막대 길이 전부가 세로가 됐습니다. 세울수록 가로는 줄고 세로는 늡니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.0,
      1.0
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 1",
     "labelAt": [
      -0.12,
      0.64
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.0,
      0
     ],
     "color": "accent2",
     "label": "가로 0",
     "labelAt": [
      0.0,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.0,
      0
     ],
     "to": [
      0.0,
      1.0
     ],
     "color": "warn",
     "label": "세로 1",
     "labelAt": [
      0.3,
      0.5
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.21,
      0.18
     ],
     "color": "text",
     "label": "90°"
    }
   ]
  }
 ]
}
</script>
</x-vec>

| 각도 | 가로 | 세로 |
| --- | --- | --- |
| 0° | 1 | 0 |
| 30° | 0.87 | 0.5 |
| 45° | 0.71 | 0.71 |
| 60° | 0.5 | 0.87 |
| 90° | 0 | 1 |

**각도를 정하면 가로와 세로가 하나로 정해집니다.** 30° 로 세운 길이 1 막대의 가로는 언제 재도 0.87 입니다.

## 크기가 달라도 비율은 같다

각도는 30° 그대로 두고 막대 길이만 1, 2, 3 으로 늘렸습니다.

<x-vec>
<script type="application/json">
{
 "label": "각도는 30° 그대로, 막대만 길게",
 "view": [
  -0.4,
  -0.6,
  3.3,
  2.0
 ],
 "steps": [
  {
   "caption": "길이 1, 각도 30°. 가로 0.87, 세로 0.5. 가로 ÷ 빗변 = 0.87, 세로 ÷ 빗변 = 0.5.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.87,
      0.5
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 1",
     "labelAt": [
      0.38,
      0.39
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.87,
      0
     ],
     "color": "accent2",
     "label": "가로 0.87",
     "labelAt": [
      0.43,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.87,
      0
     ],
     "to": [
      0.87,
      0.5
     ],
     "color": "warn",
     "label": "세로 0.5",
     "labelAt": [
      1.17,
      0.25
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.26,
      0.08
     ],
     "color": "text",
     "label": "30°"
    }
   ]
  },
  {
   "caption": "길이 2. 가로 1.73, 세로 1. 둘 다 두 배가 됐습니다. 가로 ÷ 빗변 = 1.73 ÷ 2 = 0.87, 세로 ÷ 빗변 = 1 ÷ 2 = 0.5. 비율은 그대로입니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      1.73,
      1.0
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 2",
     "labelAt": [
      0.74,
      0.78
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1.73,
      0
     ],
     "color": "accent2",
     "label": "가로 1.73",
     "labelAt": [
      0.86,
      -0.28
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      1.73,
      0
     ],
     "to": [
      1.73,
      1.0
     ],
     "color": "warn",
     "label": "세로 1",
     "labelAt": [
      2.33,
      0.5
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.53,
      0.13
     ],
     "color": "text",
     "label": "30°"
    }
   ]
  },
  {
   "caption": "길이 3. 가로 2.6, 세로 1.5. 2.6 ÷ 3 = 0.87, 1.5 ÷ 3 = 0.5. 삼각형 크기가 달라도 각도가 같으면 비율이 같습니다. 이 두 비율이 cos 30° 와 sin 30° 입니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      2.6,
      1.5
     ],
     "rigid": true,
     "color": "accent",
     "label": "빗변 3",
     "labelAt": [
      1.12,
      1.17
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      2.6,
      0
     ],
     "color": "accent2",
     "label": "가로 2.6",
     "labelAt": [
      1.3,
      -0.42
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      2.6,
      0
     ],
     "to": [
      2.6,
      1.5
     ],
     "color": "warn",
     "label": "세로 1.5",
     "labelAt": [
      3.5,
      0.75
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0.79,
      0.19
     ],
     "color": "text",
     "label": "30°"
    }
   ]
  }
 ]
}
</script>
</x-vec>

| 빗변 | 가로 | 세로 | 가로 ÷ 빗변 | 세로 ÷ 빗변 |
| --- | --- | --- | --- | --- |
| 1 | 0.87 | 0.5 | 0.87 | 0.5 |
| 2 | 1.73 | 1 | 0.87 | 0.5 |
| 3 | 2.6 | 1.5 | 0.87 | 0.5 |

막대가 두 배면 가로와 세로도 두 배가 됩니다. 삼각형이 모양은 그대로 크기만 커지기 때문입니다. 사진을 확대해도 사람의 키와 어깨 너비 비율이 그대로인 것과 같습니다.
그래서 **가로 ÷ 빗변 과 세로 ÷ 빗변 은 삼각형 크기와 상관없이 각도만으로 정해집니다.** 이 두 비율에 이름을 붙인 것이 cos 와 sin 입니다.
각도를 글자로 적을 때는 **θ**(세타)를 씁니다. x 가 "어떤 수" 를 뜻하듯 θ 는 "어떤 각도" 를 뜻합니다.

```text
cos θ = 가로 ÷ 빗변     (θ 일 때 가로는 빗변의 몇 배인가)
sin θ = 세로 ÷ 빗변     (θ 일 때 세로는 빗변의 몇 배인가)
```

cos 는 "코사인", sin 은 "사인" 이라고 읽습니다. 각도를 넣으면 숫자 하나가 나오는 **함수**입니다. cos 30° = 0.87, sin 30° = 0.5 처럼 씁니다.
식을 뒤집으면 실제로 쓰는 모양이 됩니다.

```text
가로 = 빗변 × cos θ
세로 = 빗변 × sin θ
```

길이 4m 사다리를 바닥과 60° 로 벽에 기대면, 사다리 끝의 높이는 4 × sin 60° = 4 × 0.87 = **3.46m**, 벽에서 사다리 발까지는 4 × cos 60° = 4 × 0.5 = **2m** 입니다.
자로 재지 않아도 길이와 각도만으로 두 변이 나옵니다.

참고로 세로 ÷ 가로 도 이름이 있습니다. **tan**(탄젠트)이고, 비탈의 기울기입니다. 이 글에서는 cos 와 sin 만 씁니다.

## 값은 어떻게 아나

cos 와 sin 의 값은 계산기나 `Mathf.Cos`, `Mathf.Sin` 이 알려 줍니다. 다만 자주 쓰는 각도 셋은 직각삼각형의 길이 규칙(피타고라스의 정리)만으로 직접 구할 수 있습니다.
피타고라스의 정리는 **가로² + 세로² = 빗변²** 입니다. 가로 3, 세로 4 면 9 + 16 = 25 라서 빗변이 5 입니다.

**45°** 는 가로와 세로가 같은 삼각형입니다. 빗변이 1 이면 가로를 a 라 할 때 a² + a² = 1, 곧 a² = 0.5 라서 a = √0.5 ≈ **0.71** 입니다. 그래서 cos 45° = sin 45° = 0.71 입니다.

**60° 와 30°** 는 세 변이 모두 1 인 정삼각형을 반으로 자르면 나옵니다.

| 단계 | 계산 | 결과 |
| --- | --- | --- |
| 정삼각형을 세로로 반 자름 | 바닥 1 이 절반 | 가로 0.5, 빗변 1, 아래 각 60° |
| 세로 구하기 | 0.5² + 세로² = 1² → 세로² = 0.75 | 세로 ≈ 0.87 |
| 60° 쪽에서 보면 | 가로 0.5, 세로 0.87 | cos 60° = 0.5, sin 60° = 0.87 |
| 30° 쪽에서 보면 | 가로와 세로가 뒤바뀜 | cos 30° = 0.87, sin 30° = 0.5 |

30° 와 60° 에서 값이 서로 자리를 바꾼 것은, 같은 삼각형을 반대쪽 꼭짓점에서 봤기 때문입니다.

## 길이와 각도로 가로와 세로 구하기

처음의 대포는 30° 로, 1초에 10 만큼 쏩니다.

<x-vec>
<script type="application/json">
{
 "label": "30° 로 속도 10 쏘기",
 "view": [
  -1,
  -1.2,
  11,
  6.5
 ],
 "steps": [
  {
   "caption": "대포가 30° 로 1초에 10 만큼 날아가는 포탄을 쏩니다. 화살표 길이가 10 입니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      8.66,
      5
     ],
     "label": "속도 10",
     "labelAt": [
      3.6,
      3.2
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      1.6,
      0.35
     ],
     "label": "30°"
    }
   ]
  },
  {
   "caption": "화살표 끝에서 바닥으로 수직선을 내려 직각삼각형을 만듭니다. 빗변이 10 인 삼각형입니다.",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      8.66,
      5
     ],
     "label": "속도 10",
     "labelAt": [
      3.6,
      3.2
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      1.6,
      0.35
     ],
     "label": "30°"
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      8.66,
      0
     ],
     "color": "accent2"
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      8.66,
      0
     ],
     "to": [
      8.66,
      5
     ],
     "color": "warn"
    }
   ]
  },
  {
   "caption": "가로 = 빗변 × cos 30° = 10 × 0.87 = 8.66. 세로 = 빗변 × sin 30° = 10 × 0.5 = 5. 포탄은 1초에 앞으로 8.66, 위로 5 만큼 갑니다.",
   "code": "vx = 10 * cos30  // 8.66\nvy = 10 * sin30  // 5",
   "items": [
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      8.66,
      5
     ],
     "label": "속도 10",
     "labelAt": [
      3.6,
      3.2
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      1.6,
      0.35
     ],
     "label": "30°"
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      8.66,
      0
     ],
     "color": "accent2",
     "label": "10 × cos 30° = 8.66",
     "labelAt": [
      4.33,
      -0.7
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      8.66,
      0
     ],
     "to": [
      8.66,
      5
     ],
     "color": "warn",
     "label": "10 × sin 30° = 5",
     "labelAt": [
      9.3,
      2.5
     ]
    }
   ]
  }
 ]
}
</script>
</x-vec>

이렇게 나눈 (8.66, 5) 의 길이를 피타고라스로 확인하면 √(8.66² + 5²) = √(75 + 25) = √100 = **10** 입니다. 길이는 지키면서 방향만 30° 로 정한 것입니다.
처음에 틀렸던 (5, 5) 는 길이가 √50 ≈ 7.07 이라 느리고, 방향도 45° 였습니다.

## 90° 를 넘으면: 원 위의 점

막대를 90° 보다 더 돌리면 막대 끝이 왼쪽으로 넘어가고, 180° 를 넘으면 바닥 아래로 내려갑니다.
이때는 가로와 세로에 **방향(부호)**을 붙입니다. 오른쪽과 위는 양수, 왼쪽과 아래는 음수입니다.

<x-vec>
<script type="application/json">
{
 "label": "90° 를 넘겨 한 바퀴",
 "view": [
  -1.5,
  -1.45,
  1.6,
  1.45
 ],
 "steps": [
  {
   "caption": "60°. 막대 끝은 오른쪽 위. cos 0.5, sin 0.87. 길이 1 이라 가로와 세로가 곧 cos 와 sin 입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1.0,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.5,
      0.87
     ],
     "rigid": true,
     "color": "accent",
     "labelAt": [
      0.15,
      0.57
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.5,
      0
     ],
     "color": "accent2",
     "label": "가로 0.5",
     "labelAt": [
      0.25,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.5,
      0
     ],
     "to": [
      0.5,
      0.87
     ],
     "color": "warn",
     "label": "세로 0.87",
     "labelAt": [
      0.8,
      0.43
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      -0.05,
      0.18
     ],
     "color": "text",
     "label": "60°"
    }
   ]
  },
  {
   "caption": "120°. 90° 를 넘어 왼쪽으로 기울었습니다. 가로가 왼쪽이라 음수 −0.5 입니다. cos 120° = −0.5, sin 120° = 0.87.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1.0,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -0.5,
      0.87
     ],
     "rigid": true,
     "color": "accent",
     "labelAt": [
      -0.35,
      0.57
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      -0.5,
      0
     ],
     "color": "accent2",
     "label": "가로 −0.5",
     "labelAt": [
      -0.25,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      -0.5,
      0
     ],
     "to": [
      -0.5,
      0.87
     ],
     "color": "warn",
     "label": "세로 0.87",
     "labelAt": [
      -0.8,
      0.43
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      -0.05,
      0.18
     ],
     "color": "text",
     "label": "120°"
    }
   ]
  },
  {
   "caption": "180°. 왼쪽으로 완전히 누웠습니다. cos 180° = −1, sin 180° = 0.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1.0,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -1.0,
      0.0
     ],
     "rigid": true,
     "color": "accent",
     "labelAt": [
      -0.5,
      0.14
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      -1.0,
      0
     ],
     "color": "accent2",
     "label": "가로 −1",
     "labelAt": [
      -0.5,
      -0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      -1.0,
      0
     ],
     "to": [
      -1.0,
      0.0
     ],
     "color": "warn",
     "label": "세로 0",
     "labelAt": [
      -1.3,
      0.0
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      -0.05,
      0.18
     ],
     "color": "text",
     "label": "180°"
    }
   ]
  },
  {
   "caption": "240°. 왼쪽 아래. 가로도 세로도 음수입니다. cos −0.5, sin −0.87.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1.0,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -0.5,
      -0.87
     ],
     "rigid": true,
     "color": "accent",
     "labelAt": [
      -0.15,
      -0.29
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      -0.5,
      0
     ],
     "color": "accent2",
     "label": "가로 −0.5",
     "labelAt": [
      -0.25,
      0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      -0.5,
      0
     ],
     "to": [
      -0.5,
      -0.87
     ],
     "color": "warn",
     "label": "세로 −0.87",
     "labelAt": [
      -0.8,
      -0.43
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      -0.05,
      0.18
     ],
     "color": "text",
     "label": "240°"
    }
   ]
  },
  {
   "caption": "300°. 오른쪽 아래. 가로는 다시 양수 0.5, 세로는 음수 −0.87. 막대 끝이 그리는 자취가 반지름 1 인 원이고, 그 원 위의 점이 늘 (cos, sin) 입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1.0,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.5,
      -0.87
     ],
     "rigid": true,
     "color": "accent",
     "labelAt": [
      0.35,
      -0.29
     ]
    },
    {
     "id": "h",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      0.5,
      0
     ],
     "color": "accent2",
     "label": "가로 0.5",
     "labelAt": [
      0.25,
      0.14
     ]
    },
    {
     "id": "u",
     "type": "line",
     "from": [
      0.5,
      0
     ],
     "to": [
      0.5,
      -0.87
     ],
     "color": "warn",
     "label": "세로 −0.87",
     "labelAt": [
      0.8,
      -0.43
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      -0.05,
      0.18
     ],
     "color": "text",
     "label": "300°"
    }
   ]
  }
 ]
}
</script>
</x-vec>

길이 1 인 막대 끝은 반지름 1 인 원을 그립니다. 빗변이 1 이니 가로 ÷ 1 = 가로, 세로 ÷ 1 = 세로 라서, **원 위의 점의 좌표가 그대로 (cos θ, sin θ)** 입니다.
수학책이 cos 와 sin 을 "반지름 1 인 원 위의 점의 x 와 y" 로 정의하는 것도 이 때문이고, 90° 안에서는 삼각형으로 정의한 것과 똑같은 값입니다.

| 막대 끝이 있는 곳 | 각도 | cos (가로) | sin (세로) |
| --- | --- | --- | --- |
| 오른쪽 위 | 0° ~ 90° | + | + |
| 왼쪽 위 | 90° ~ 180° | − | + |
| 왼쪽 아래 | 180° ~ 270° | − | − |
| 오른쪽 아래 | 270° ~ 360° | + | − |

원의 반지름이 1 이라 cos 와 sin 은 **늘 −1 에서 1 사이**입니다. 360° 를 돌면 처음 자리로 돌아오니 같은 값이 되풀이됩니다. sin 390° 는 sin 30° 와 같은 0.5 입니다.

## 유니티는 각도를 라디안으로 받는다

이제 대포를 유니티 코드로 옮깁니다. 그런데 `Mathf.Sin(30)` 이라고 쓰면 0.5 가 아니라 **−0.99** 가 나옵니다.
`Mathf.Sin`, `Mathf.Cos` 는 각도를 도(°)가 아니라 **라디안**이라는 다른 단위로 받기 때문입니다. 30 을 30° 가 아니라 30 라디안으로 읽은 것입니다.

**라디안은 각을 "반지름 1 인 원에서 막대 끝이 둘레를 따라 간 거리" 로 잽니다.** 도가 한 바퀴를 360 칸으로 나눈 눈금이라면, 라디안은 줄자로 둘레를 잰 길이입니다.

<x-vec>
<script type="application/json">
{
 "label": "반지름 1 인 원에서 각을 간 거리로 재기",
 "view": [
  -1.7,
  -1.85,
  1.7,
  1.6
 ],
 "steps": [
  {
   "caption": "반지름 1 인 원입니다. 막대 끝이 오른쪽 (1, 0) 에서 출발해 원을 따라 돕니다. 점에 붙은 숫자는 막대 끝이 원 둘레를 따라 간 거리입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "r",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1,
      0
     ],
     "color": "muted",
     "label": "반지름 1",
     "labelAt": [
      0.2,
      -0.25
     ]
    },
    {
     "id": "a",
     "from": [
      0,
      0
     ],
     "to": [
      1.0,
      0.0
     ],
     "rigid": true
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0,
      -1.62
     ],
     "color": "accent2",
     "label": "0° = 0 라디안"
    }
   ]
  },
  {
   "caption": "막대 끝이 원을 따라 1 만큼 갔습니다. 반지름과 같은 길이입니다. 이때 벌어진 각이 1 라디안이고, 도로 재면 약 57.3° 입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "r",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1,
      0
     ],
     "color": "muted",
     "label": "반지름 1",
     "labelAt": [
      0.2,
      -0.25
     ]
    },
    {
     "id": "a",
     "from": [
      0,
      0
     ],
     "to": [
      0.54,
      0.841
     ],
     "rigid": true
    },
    {
     "id": "m1",
     "type": "point",
     "at": [
      0.54,
      0.841
     ],
     "color": "accent2",
     "label": "1",
     "labelAt": [
      0.65,
      1.05
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0,
      -1.62
     ],
     "color": "accent2",
     "label": "57.3° = 1 라디안"
    }
   ]
  },
  {
   "caption": "90° 까지 돌면 간 거리는 약 1.57 입니다. 그래서 90° 는 1.57 라디안, 곧 π / 2 입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "r",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1,
      0
     ],
     "color": "muted",
     "label": "반지름 1",
     "labelAt": [
      0.2,
      -0.25
     ]
    },
    {
     "id": "a",
     "from": [
      0,
      0
     ],
     "to": [
      0.0,
      1.0
     ],
     "rigid": true
    },
    {
     "id": "m1",
     "type": "point",
     "at": [
      0.54,
      0.841
     ],
     "color": "accent2",
     "label": "1",
     "labelAt": [
      0.65,
      1.05
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0,
      -1.62
     ],
     "color": "accent2",
     "label": "90° = 1.57 라디안"
    }
   ]
  },
  {
   "caption": "180° 까지 돌면 간 거리는 약 3.14 입니다. 이 수를 π(파이)라고 부릅니다. 180° = π 라디안입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "r",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1,
      0
     ],
     "color": "muted",
     "label": "반지름 1",
     "labelAt": [
      0.2,
      -0.25
     ]
    },
    {
     "id": "a",
     "from": [
      0,
      0
     ],
     "to": [
      -1.0,
      0.0
     ],
     "rigid": true
    },
    {
     "id": "m1",
     "type": "point",
     "at": [
      0.54,
      0.841
     ],
     "color": "accent2",
     "label": "1",
     "labelAt": [
      0.65,
      1.05
     ]
    },
    {
     "id": "m2",
     "type": "point",
     "at": [
      -0.416,
      0.909
     ],
     "color": "accent2",
     "label": "2",
     "labelAt": [
      -0.61,
      1.14
     ]
    },
    {
     "id": "m3",
     "type": "point",
     "at": [
      -0.99,
      0.141
     ],
     "color": "accent2",
     "label": "3",
     "labelAt": [
      -1.37,
      0.13
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0,
      -1.62
     ],
     "color": "accent2",
     "label": "180° = 3.14 라디안"
    }
   ]
  },
  {
   "caption": "270° 면 약 4.71 을 갔습니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "r",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1,
      0
     ],
     "color": "muted",
     "label": "반지름 1",
     "labelAt": [
      0.2,
      -0.25
     ]
    },
    {
     "id": "a",
     "from": [
      0,
      0
     ],
     "to": [
      -0.0,
      -1.0
     ],
     "rigid": true
    },
    {
     "id": "m1",
     "type": "point",
     "at": [
      0.54,
      0.841
     ],
     "color": "accent2",
     "label": "1",
     "labelAt": [
      0.65,
      1.05
     ]
    },
    {
     "id": "m2",
     "type": "point",
     "at": [
      -0.416,
      0.909
     ],
     "color": "accent2",
     "label": "2",
     "labelAt": [
      -0.61,
      1.14
     ]
    },
    {
     "id": "m3",
     "type": "point",
     "at": [
      -0.99,
      0.141
     ],
     "color": "accent2",
     "label": "3",
     "labelAt": [
      -1.37,
      0.13
     ]
    },
    {
     "id": "m4",
     "type": "point",
     "at": [
      -0.654,
      -0.757
     ],
     "color": "accent2",
     "label": "4",
     "labelAt": [
      -0.92,
      -1.06
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0,
      -1.62
     ],
     "color": "accent2",
     "label": "270° = 4.71 라디안"
    }
   ]
  },
  {
   "caption": "한 바퀴 360° 를 돌면 원 둘레 전체, 약 6.28 을 갑니다. 반지름 1 짜리 여섯 개하고 조금 더입니다. 360° = 2π 라디안입니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "r",
     "type": "line",
     "from": [
      0,
      0
     ],
     "to": [
      1,
      0
     ],
     "color": "muted",
     "label": "반지름 1",
     "labelAt": [
      0.2,
      -0.25
     ]
    },
    {
     "id": "a",
     "from": [
      0,
      0
     ],
     "to": [
      1.0,
      -0.002
     ],
     "rigid": true
    },
    {
     "id": "m1",
     "type": "point",
     "at": [
      0.54,
      0.841
     ],
     "color": "accent2",
     "label": "1",
     "labelAt": [
      0.65,
      1.05
     ]
    },
    {
     "id": "m2",
     "type": "point",
     "at": [
      -0.416,
      0.909
     ],
     "color": "accent2",
     "label": "2",
     "labelAt": [
      -0.61,
      1.14
     ]
    },
    {
     "id": "m3",
     "type": "point",
     "at": [
      -0.99,
      0.141
     ],
     "color": "accent2",
     "label": "3",
     "labelAt": [
      -1.37,
      0.13
     ]
    },
    {
     "id": "m4",
     "type": "point",
     "at": [
      -0.654,
      -0.757
     ],
     "color": "accent2",
     "label": "4",
     "labelAt": [
      -0.92,
      -1.06
     ]
    },
    {
     "id": "m5",
     "type": "point",
     "at": [
      0.284,
      -0.959
     ],
     "color": "accent2",
     "label": "5",
     "labelAt": [
      0.31,
      -1.33
     ]
    },
    {
     "id": "m6",
     "type": "point",
     "at": [
      0.96,
      -0.279
     ],
     "color": "accent2",
     "label": "6",
     "labelAt": [
      1.21,
      -0.43
     ]
    },
    {
     "id": "t",
     "type": "text",
     "at": [
      0,
      -1.62
     ],
     "color": "accent2",
     "label": "360° = 6.28 라디안"
    }
   ]
  }
 ]
}
</script>
</x-vec>

반지름 1 인 원의 둘레는 2 × π ≈ **6.28** 입니다(π 는 약 3.14). 그래서 한 바퀴가 6.28 라디안이고, 나머지는 그 몇 분의 몇입니다.

| 도 | 라디안 | 한 바퀴의 몇 분의 몇 |
| --- | --- | --- |
| 360° | 2π ≈ 6.28 | 1 |
| 180° | π ≈ 3.14 | 1/2 |
| 90° | π/2 ≈ 1.57 | 1/4 |
| 30° | π/6 ≈ 0.52 | 1/12 |
| 약 57.3° | 1 | 둘레를 반지름만큼 간 각 |

360° 가 6.28 라디안이니, 1° 는 6.28 ÷ 360 ≈ **0.01745** 라디안입니다. 도에 이 값을 곱하면 라디안이 됩니다. 반대로 1 라디안은 360 ÷ 6.28 ≈ **57.3°** 입니다.
유니티는 이 두 값을 상수로 줍니다.

| 상수 | 값 | 예 |
| --- | --- | --- |
| `Mathf.Deg2Rad` | π / 180 ≈ 0.01745 | 30 × 0.01745 ≈ 0.52. 30° 는 0.52 라디안 |
| `Mathf.Rad2Deg` | 180 / π ≈ 57.3 | 0.52 × 57.3 ≈ 30. 0.52 라디안은 30° |

이제 `Mathf.Sin(30)` 이 −0.99 인 이유가 보입니다. 30 라디안은 30 × 57.3 ≈ 1719° 입니다. 1719° 는 네 바퀴(1440°)를 돌고 279° 를 더 간 자리라서, 원의 오른쪽 아래에 있고 높이(sin)가 −0.99 입니다.
그래서 도로 생각한 각도는 **`Mathf.Deg2Rad` 를 곱해서** 넣습니다.

수학과 프로그래밍 언어가 라디안을 쓰는 것은 간 거리와 각이 같은 숫자라서 계산이 단순해지기 때문입니다. 반지름 r 인 원을 θ 라디안 돌면 간 거리는 그냥 r × θ 입니다.
반대로 유니티 에디터의 Rotation, `transform.eulerAngles`, `Quaternion.Euler` 는 사람이 읽기 쉬운 **도**를 씁니다. 수학 함수를 부르는 자리에서만 바꿔 줍니다.

대포 코드는 이렇습니다.

```csharp
float angle = 30f;
float speed = 10f;

// Mathf.Cos, Mathf.Sin 은 라디안을 받는다.
// Deg2Rad(약 0.01745)를 곱하면 30° 가 0.52 라디안이 된다
float rad = angle * Mathf.Deg2Rad;

float vx = speed * Mathf.Cos(rad);   // 가로 = 빗변 × cos 30° = 8.66
float vy = speed * Mathf.Sin(rad);   // 세로 = 빗변 × sin 30° = 5

// rb 는 포탄에 붙은 Rigidbody2D. 속도를 (가로, 세로) 로 넣는다
rb.linearVelocity = new Vector2(vx, vy);
```

## sin 은 물결이 된다

원 위를 도는 점의 높이(sin)를 각도가 늘어나는 순서대로 오른쪽에 찍었습니다.

<x-vec>
<script type="application/json">
{
 "label": "원 위의 높이를 시간 순서대로 찍으면",
 "ticks": false,
 "view": [
  -1.3,
  -1.4,
  9.2,
  1.7
 ],
 "steps": [
  {
   "caption": "0°. 높이 0.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      1.0,
      0.0
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      1.0,
      0.0
     ],
     "to": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "0° → sin = 0"
    }
   ]
  },
  {
   "caption": "45°. 높이 0.71.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.71,
      0.71
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      0.71,
      0.71
     ],
     "to": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "45° → sin = 0.71"
    }
   ]
  },
  {
   "caption": "90°. 가장 높은 1.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.0,
      1.0
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      0.0,
      1.0
     ],
     "to": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "90° → sin = 1"
    }
   ]
  },
  {
   "caption": "135°. 다시 내려와 0.71.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -0.71,
      0.71
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      -0.71,
      0.71
     ],
     "to": [
      2.8,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p3",
     "type": "point",
     "at": [
      2.8,
      0.71
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "135° → sin = 0.71"
    }
   ]
  },
  {
   "caption": "180°. 0 으로 돌아왔습니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -1.0,
      0.0
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      -1.0,
      0.0
     ],
     "to": [
      3.2,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p3",
     "type": "point",
     "at": [
      2.8,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p4",
     "type": "point",
     "at": [
      3.2,
      0.0
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "180° → sin = 0"
    }
   ]
  },
  {
   "caption": "225°. 아래로 내려가 −0.71.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -0.71,
      -0.71
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      -0.71,
      -0.71
     ],
     "to": [
      3.6,
      -0.71
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p3",
     "type": "point",
     "at": [
      2.8,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p4",
     "type": "point",
     "at": [
      3.2,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p5",
     "type": "point",
     "at": [
      3.6,
      -0.71
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "225° → sin = −0.71"
    }
   ]
  },
  {
   "caption": "270°. 가장 낮은 −1.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      -0.0,
      -1.0
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      -0.0,
      -1.0
     ],
     "to": [
      4.0,
      -1.0
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p3",
     "type": "point",
     "at": [
      2.8,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p4",
     "type": "point",
     "at": [
      3.2,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p5",
     "type": "point",
     "at": [
      3.6,
      -0.71
     ],
     "color": "muted"
    },
    {
     "id": "p6",
     "type": "point",
     "at": [
      4.0,
      -1.0
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "270° → sin = −1"
    }
   ]
  },
  {
   "caption": "315°. 올라오는 중 −0.71.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      0.71,
      -0.71
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      0.71,
      -0.71
     ],
     "to": [
      4.4,
      -0.71
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p3",
     "type": "point",
     "at": [
      2.8,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p4",
     "type": "point",
     "at": [
      3.2,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p5",
     "type": "point",
     "at": [
      3.6,
      -0.71
     ],
     "color": "muted"
    },
    {
     "id": "p6",
     "type": "point",
     "at": [
      4.0,
      -1.0
     ],
     "color": "muted"
    },
    {
     "id": "p7",
     "type": "point",
     "at": [
      4.4,
      -0.71
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "315° → sin = −0.71"
    }
   ]
  },
  {
   "caption": "360°. 한 바퀴를 돌아 0. 찍은 점을 이으면 올라갔다 내려오는 물결이 됩니다. 각도를 계속 늘리면 이 물결이 끝없이 되풀이됩니다.",
   "items": [
    {
     "id": "c",
     "type": "circle",
     "at": [
      0,
      0
     ],
     "r": 1,
     "color": "muted"
    },
    {
     "id": "v",
     "from": [
      0,
      0
     ],
     "to": [
      1.0,
      -0.0
     ],
     "rigid": true
    },
    {
     "id": "g",
     "type": "line",
     "from": [
      1.0,
      -0.0
     ],
     "to": [
      4.8,
      -0.0
     ],
     "color": "muted"
    },
    {
     "id": "p0",
     "type": "point",
     "at": [
      1.6,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p1",
     "type": "point",
     "at": [
      2.0,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p2",
     "type": "point",
     "at": [
      2.4,
      1.0
     ],
     "color": "muted"
    },
    {
     "id": "p3",
     "type": "point",
     "at": [
      2.8,
      0.71
     ],
     "color": "muted"
    },
    {
     "id": "p4",
     "type": "point",
     "at": [
      3.2,
      0.0
     ],
     "color": "muted"
    },
    {
     "id": "p5",
     "type": "point",
     "at": [
      3.6,
      -0.71
     ],
     "color": "muted"
    },
    {
     "id": "p6",
     "type": "point",
     "at": [
      4.0,
      -1.0
     ],
     "color": "muted"
    },
    {
     "id": "p7",
     "type": "point",
     "at": [
      4.4,
      -0.71
     ],
     "color": "muted"
    },
    {
     "id": "p8",
     "type": "point",
     "at": [
      4.8,
      -0.0
     ],
     "color": "warn"
    },
    {
     "id": "txt",
     "type": "text",
     "at": [
      2.4,
      1.35
     ],
     "color": "warn",
     "label": "360° → sin = −0"
    }
   ]
  }
 ]
}
</script>
</x-vec>

0 에서 올라가 1, 다시 내려가 −1, 그리고 0 으로 돌아오는 물결이 나옵니다. 각도 대신 **시간**을 넣으면 시간이 흐를수록 위아래로 흔들리는 값이 됩니다.
아이템이 제자리에서 둥실둥실 떠 있는 연출이 이것입니다.

```csharp
Vector3 start;
public float height = 0.25f;   // 얼마나 높이 흔들리나
public float speed = 2f;       // 얼마나 빨리 흔들리나

void Start()
{
    start = transform.position;
}

void Update()
{
    // Time.time 은 게임이 시작된 뒤 지난 초. 계속 늘어나니 sin 이 물결을 그린다
    // Mathf.Sin 은 라디안을 받으니, speed 2 면 1초에 2 라디안씩 돈다
    float wave = Mathf.Sin(Time.time * speed);   // −1 ~ 1

    transform.position = start + Vector3.up * wave * height;   // −0.25 ~ 0.25 사이로
}
```

sin 이 −1 ~ 1 이라 `height` 를 곱하면 그만큼 위아래로 흔들립니다. 여기서는 각도 대신 `Time.time * speed` 를 넣었으니 그 값이 라디안으로 읽힙니다. 한 번 출렁이는 데 한 바퀴 6.28 라디안이 필요하므로, `speed` 가 2 면 6.28 ÷ 2 ≈ 3.14초에 한 번 위아래를 오갑니다. 같은 자리에 cos 를 쓰면 0 이 아니라 1(가장 높은 곳)에서 출발하는 같은 물결입니다.

## 기억해 둘 성질

| 성질 | 왜 그런가 | 확인 |
| --- | --- | --- |
| cos 와 sin 은 −1 ~ 1 | 반지름 1 인 원 위의 좌표라서 | |
| cos² θ + sin² θ = 1 | 가로² + 세로² = 빗변² 에 빗변 1 을 넣은 것 | 30°: 0.87² + 0.5² = 0.75 + 0.25 = 1 |
| sin θ = cos(90° − θ) | 같은 삼각형을 반대쪽 각에서 보면 가로와 세로가 바뀜 | sin 30° = cos 60° = 0.5 |
| 0° ~ 90° 에서 각이 커지면 cos 는 줄고 sin 은 늚 | 막대를 세울수록 가로가 줄고 세로가 늘어서 | |
| 360° 마다 되풀이 | 한 바퀴 돌면 같은 자리 | sin 390° = sin 30° |

## 정리

- 비스듬한 화살표의 끝에서 바닥으로 수직선을 내리면 직각삼각형이 생깁니다. 화살표가 빗변, 나머지가 가로와 세로입니다
- 각도가 같으면 삼각형 크기와 상관없이 가로 ÷ 빗변, 세로 ÷ 빗변 이 같습니다. 이 비율이 cos 와 sin 입니다
- 가로 = 길이 × cos θ, 세로 = 길이 × sin θ. 30° 로 10 이면 (8.66, 5) 입니다
- 45° 는 0.71, 30° 와 60° 는 0.87 과 0.5 를 서로 바꿔 가집니다
- 길이 1 인 화살표 끝은 반지름 1 인 원 위에 있고, 그 점이 (cos θ, sin θ) 입니다. 왼쪽과 아래는 음수입니다
- cos 와 sin 은 −1 ~ 1 이고, cos² + sin² = 1 입니다
- 시간을 넣은 sin 은 위아래로 흔들리는 물결이 됩니다
- 라디안은 반지름 1 인 원에서 둘레를 따라 간 거리로 잰 각입니다. 한 바퀴가 2π ≈ 6.28, 180° 가 π ≈ 3.14 입니다
- `Mathf.Cos` 와 `Mathf.Sin` 은 각도를 라디안으로 받으니 도에 `Mathf.Deg2Rad` 를 곱해 넣습니다. `Mathf.Sin(30)` 은 sin 30° 가 아닙니다