14 lines
517 B
Crystal
14 lines
517 B
Crystal
require "../../src/engine/trajectory"
|
|
|
|
describe Trajectory do
|
|
it "test without gravity field nor acceleration" do
|
|
t = Trajectory(2).new(body: Gravity::MovingBody.new(mass: 1.0, position: Vector[0.0, 0.0], speed: Vector[1.0, 0.5]))
|
|
points = t.compute(steps: 10, accuracy: Time::Span.new(seconds: 1))
|
|
points.size.should eq(10)
|
|
points[0].should eq(Vector[1.0, 0.5])
|
|
points[1].should eq(Vector[2.0, 1.0])
|
|
points[2].should eq(Vector[3.0, 1.5])
|
|
points[3].should eq(Vector[4.0, 2.0])
|
|
end
|
|
end
|