Draw masses with fixed radii
This commit is contained in:
parent
df9969d20b
commit
9d08799f80
10
Main.hs
10
Main.hs
@ -21,12 +21,18 @@ minorMass = 20
|
|||||||
initialState :: State
|
initialState :: State
|
||||||
initialState = State (PolarCoord 300 0) 0 0.001
|
initialState = State (PolarCoord 300 0) 0 0.001
|
||||||
|
|
||||||
|
majorRadius :: Float
|
||||||
|
majorRadius = 20
|
||||||
|
|
||||||
|
minorRadius :: Float
|
||||||
|
minorRadius = 5
|
||||||
|
|
||||||
framesPerSecond :: Int
|
framesPerSecond :: Int
|
||||||
framesPerSecond = 120
|
framesPerSecond = 120
|
||||||
|
|
||||||
render :: State -> Picture
|
render :: State -> Picture
|
||||||
render state = pictures [ circleSolid (sqrt majorMass)
|
render state = pictures [ circleSolid majorRadius
|
||||||
, translatePolar (position state) $ circleSolid (sqrt minorMass) ]
|
, translatePolar (position state) $ circleSolid minorRadius ]
|
||||||
|
|
||||||
step :: a -> b -> State -> State
|
step :: a -> b -> State -> State
|
||||||
step _ _ state = state { position = nextPosition state
|
step _ _ state = state { position = nextPosition state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user