Skip to content

Commit

Permalink
수식 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
xtra72 committed Jan 31, 2024
1 parent 7838077 commit 20dc567
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 18 deletions.
35 changes: 23 additions & 12 deletions 04.bounded_world.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ image::./image/figure18.png"[title="bounce 보정",align=center]

* 방향별로 튕겨질때의 보정 좌표 계산은 다음과 같다.
** 오른쪽 경계 충돌
$$
[steam]
---
\begin{align*}
X_R & = X_2 - r\\
x_2 &= x_1 + |d_x|\\
Expand All @@ -119,9 +120,11 @@ x_3 &= X_R - (|d_x| - (X_R - x_1))\\
&= 2{(X_2 - r)} - x_2\\
y_3 &= y_1 + dy\\
\end{align*}
$$
---

** 왼쪽 경계 충돌
$$
[steam]
---
\begin{align*}
X_L & = X_1 + r\\
x_2 & = x_1 - |d_x|\\
Expand All @@ -132,9 +135,12 @@ x_3 &= X_L + (|d_x| - (x_1 - X_L))\\
&= 2{(X_1 + r)} - x_2\\
y_3 &= y_1 + d_y\\
\end{align*}
$$
---

** 위쪽 경계 충돌
$$

[steam]
---
\begin{align*}
Y_T & = Y_2 - r\\
y_2 &= y_1 + |d_y|\\
Expand All @@ -144,9 +150,12 @@ y_3 &= Y_T - (|d_y| - (Y_T - y_1))\\
&= 2{(Y_2 - r)} - y_2\\
x_3 &= x_1 + d_x\\
\end{align*}
$$
---

** 아래쪽 경계 충돌
$$

[steam]
---
\begin{align*}
Y_B & = Y_1 + r\\
y_2 & = y_1 - |d_y|\\
Expand All @@ -157,7 +166,7 @@ y_3 &= Y_B + (|d_y| - (y_1 - Y_B))\\
&= 2{(Y_1 + r)} - y_2\\
x_3 &= x_1 + d_x\\
\end{align*}
$$
---

{empty} +

Expand Down Expand Up @@ -267,12 +276,13 @@ image::./image/figure21.png"[title="물체 간 충돌", align=center]
image::./image/figure22.png"[title="ball 간 거리",align=center]

* ball 간 거리는
$$
[steam]
---
\begin{align*}
중심 간 거리(D) &= r_1+r_2+d=\sqrt{{(x_1-x_2)}^2 + {(y_1-y_2)}^2}\\
ball 간 거리(d) &= \sqrt{{(x_1-x_2)}^2 + {(y_1-y_2)}^2} - (r_1 + r_2)
\end{align*}
$$
---

ball 간 거리가 두 ball의 반지름 합보다 작을 경우, 두 ball은 충돌한 상태다.

Expand Down Expand Up @@ -309,12 +319,13 @@ image::./image/figure23.png"[title="중복되지 않는 ball",align=center]

image::./image/figure24.png"[title="ball과 box간 거리",align=center]

$$
[steam]
---
\begin{align*}
두 점의 중심 간 거리(d) &= \sqrt {{(x_1-x_2)}^2 + {(y_1-y_2)}^2}\\
최소 충돌 거리(c) &= r1 + {w_2 \over 2}
\end{align*}
$$
---

ball과 box의 충돌 역시 복잡해 보이지는 않는다. 중심 간 거리가 최소 충돌 거리도 짧으면 충돌이다.

Expand Down
5 changes: 3 additions & 2 deletions 05.abstract.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ Ball class 코드를 보도록 하자.

예를 들어, ball을 30도 각도(stem:[\theta])를 10만큼의 크기(stem:[v])로 쏜다고 해보자. x축과 y축의 변화량은 얼마인가?

$$
[steam]
---
\begin{align*}
dx = v sin \theta\\
dy = v cos \theta
\end{align*}
$$
---

계산은 가능하다. 하지만, 이것을 매번 하거나 여러 변위량이 중첩하게 된다면 매우 복잡한 계산을 반복적으로 해야 하는 번거로움이 생길 것이다.

Expand Down
10 changes: 6 additions & 4 deletions 09.external_effect.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,24 @@

* 속도
+
$$
[steam]
---
\begin{align*}
v = {dx \over dt}
\end{align*}
$$
---

** 물체의 속도와 운동 방향으로 물체의 단위 시간당 위치 변화를 나타낸다.
** 시간이 지남에 따라 물체의 위치가 변경된다.

* 가속도
+
$$
[steam]
---
\begin{align*}
a={dv \over dt}
\end{align*}
$$
---

** 속도의 변화로써 물체의 단위 시간당 속도 변화를 나타낸다.
** 시간이 지남에 따라 물체의 속도가 변경된다.
Expand Down
29 changes: 29 additions & 0 deletions cannon-game.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"folders": [
{
"name": "chapter02",
"path": "example/chapter02"
},
{
"name": "Document",
"path": "./"
},
{
"path": "example/chapter03"
},
{
"path": "example/chapter04"
},
{
"path": "example/chapter05"
},
{
"path": "example/chapter06"
}
],
"settings": {
"asciidoc.antora.enableAntoraSupport": true,
"java.configuration.updateBuildConfiguration": "interactive",
"maven.view": "hierarchical"
}
}

0 comments on commit 20dc567

Please sign in to comment.