본문 바로가기
물리코딩

달의 공전

by 로토마 2021. 6. 24.

달의 공전

지난 시간, 지구의 자전에 이어 이번엔 달의 공전을 코딩해 보았다.

지구는 저번과 똑같은 방법으로 설정했고,

달도 지구와 마찬가지로 흰색 구에 반지름, 위치벡터, 질량을 추가해 만들었다.

한 눈에 보기 쉽도록 하기위해 scailing factor를 설정해 주었다.

 

그리고 하이라이트 부분인!! 

빠-밤!

 

지구와 달 사이의 만유인력을 고려해 달이 어떤 궤도를 그리며 공전하는지 보았다.

이번에도 while문을 사용해 시간에 따라 달의 위치를 업데이트 하는 방식으로 코딩했다.

 

전체코드)

 

https://www.glowscript.org/#/user/emilyjiminroh/folder/physicscoding/program/%EB%8B%AC%EC%9D%98%EA%B3%B5%EC%A0%84

 

GlowScript IDE

GlowScript is an easy-to-use, powerful environment for creating 3D animations and publishing them on the web. Here at glowscript.org, you can write and run GlowScript programs right in your browser, store them in the cloud for free, and easily share them w

www.glowscript.org

 

'물리코딩' 카테고리의 다른 글

등속도, 등속직선, 등가속도 운동  (0) 2021.12.31
3체 운동  (0) 2021.07.07
수직(자유낙하운동) + 수평(포물선운동)  (0) 2021.06.28
달이 멈춘다면 ?!  (0) 2021.06.24
지구의 자전  (0) 2021.06.24