13 lines
459 B
Crystal
13 lines
459 B
Crystal
require "../../../src/engine/gravity/field"
|
|
|
|
describe Gravity::Field do
|
|
it "accelerate arbitrary points" do
|
|
earth = Gravity::Body(2).new(mass: 5972200000000000000000000.0, position: Vector[0.0, 0.0])
|
|
field = Gravity::Field(2).new([earth])
|
|
field = Gravity::Field(2).new(earth)
|
|
field = Gravity::Field(2).new({earth})
|
|
earth_surface = Vector[6371000.0, 0.0]
|
|
earth.acceleration(earth_surface).magnitude.round(2).should eq(9.82)
|
|
end
|
|
end
|