def test_updatePosition():
    sail = spacecraft.SolarSail(1000, 1000, 0, coordinateSystems.Vector(0, 0))
    assert sail.velocity == coordinateSystems.Vector(0, 0)
    assert sail.position == coordinateSystems.Vector(0, 0)

    sail.updatePosition(coordinateSystems.Vector(2, 0), 5)
    assert sail.velocity.x == 10
    assert sail.position.x == 25
Пример #2
0
def test_Vector():
    testVector = coordinateSystems.Vector(3, 4)

    assert testVector.magnitude == 5
    assert testVector.normalized == coordinateSystems.Vector(0.6, 0.8)
    assert testVector.normalized.magnitude == 1

    assert testVector.toTuple() == (3, 4)
    assert testVector.toPoint() == (-7, -6, 13, 14)
    assert testVector.toPerpendicular() == coordinateSystems.Vector(4, -3)
    assert testVector.toHeliocentric() == coordinateSystems.Heliocentric(
        60.74752762, 4.387518661)
def test_addForce():
    sail = spacecraft.SolarSail(1000, 1000, 0, coordinateSystems.Vector(0, 0))
    assert sail.force == coordinateSystems.Vector(0, 0)

    sail.addForce(coordinateSystems.Vector(100, 100))
    assert sail.force == coordinateSystems.Vector(1.6711229946524065e-07, 1.6711229946524065e-07)
    sail.addForce(coordinateSystems.Vector(100, 100))
    assert sail.force == coordinateSystems.Vector(1.6711229946524065e-07 * 2, 1.6711229946524065e-07 * 2)
def test_areaFacingSun():
    sail = spacecraft.SolarSail(1000, 1000, 45, coordinateSystems.Vector(960, 640))
    assert round(sail.areaFacingSun(), 3) == (sail.sailSize ** 2) / 2
Пример #5
0
def test_Sun():
    assert coordinateSystems.Sun.position == coordinateSystems.Vector(960, 540)
Пример #6
0
def test_Heliocentric():
    testHeliocentric = coordinateSystems.Heliocentric(30, 1)

    assert testHeliocentric.toVector() == coordinateSystems.Vector(
        1085, 756.5063509461097)