コード例 #1
0
class TestLeftRotationalPhysicsVector(object):
    def setup(self):
        position = Offsets(1, 0, 0)
        forces = Offsets(0, 0, -1)
        self.target = Force(position, forces)

    def test_position_direction(self):
        assert self.target.position.direction == [0, -90, 0]

    def test_force_direction(self):
        assert self.target.forces.direction == [0, 0, 0]

    def test_diff(self):
        assert self.target.diff_yaw_of_force_to_pos() == 90

    def test_vector_impacts_yaw_positively(self):
        assert 0 < self.target.yaw_momentum

    def test_c_radian(self):
        assert self.target.radians_force_is_lateral_to_position() == 0

    def test_vector_does_not_move_object(self):
        x, y, z = self.target.translation_forces()
        assert 0 == round(x, 6)
        assert 0 == round(y, 6)
        assert -1 == round(z, 6)
コード例 #2
0
class TestVectorThroughCenterOfMassFromLeft(object):
    def setup(self):
        position = Offsets(-1, 0, 0)
        forces = Offsets(1, 0, 0)
        self.target = Force(position, forces)
        self.target.force_multiplier = 1.0

    def test_object_moves_right(self):
        x, y, z = self.target.translation_forces()
        assert 1 == round(x, 6)
        assert 0 == round(y, 6)
        assert 0 == round(z, 6)
コード例 #3
0
class TestHorizontalForce45DegreesOff(object):
    def setup(self):
        position = Offsets(1, 0, -1)
        forces = Offsets(-1, 0, 0)
        self.target = Force(position, forces)
        self.target.force_multiplier = 1.0

    def test_object_moves_left(self):
        x, y, z = self.target.translation_forces()
        assert -1.0 == round(x, 1)
        assert 0 == round(y, 6)
        assert 0 == round(z, 1)
コード例 #4
0
class TestForceAtPositiveXAndYOffset(object):
    def setup(self):
        position = Offsets(1, 0, 1)
        forces = Offsets(0, 0, -1)
        self.target = Force(position, forces)
        self.target.force_multiplier = 1.0

    def test_object_moves_forwards(self):
        x, y, z = self.target.translation_forces()
        assert 0 == round(x, 6)
        assert 0 == round(y, 6)
        assert -1.0 == round(z, 1)

    def test_rotational_force_rotates_positive_yaw(self):
        assert self.target.yaw_momentum > 0
コード例 #5
0
class TestVectorThroughCenterOfMassFromRight(object):
    def setup(self):
        position = Offsets(1, 0, 0)
        forces = Offsets(-1, 0, 0)
        self.target = Force(position, forces)
        self.target.force_multiplier = 1.0

    def test_position_direction_is_90(self):
        assert self.target.position.direction == Offsets(0, -90, 0)

    def test_object_moves_left(self):
        x, y, z = self.target.translation_forces()
        assert -1 == round(x, 6)
        assert 0 == round(y, 6)
        assert 0 == round(z, 6)
コード例 #6
0
class TestRightRotationalPhysicsVector(object):
    def setup(self):
        position = Offsets(-1, 0, 0)
        forces = Offsets(0, 0, -1)
        self.target = Force(position, forces)

    def test_position_direction(self):
        assert self.target.position.direction == [0, 90, 0]

    def test_force_direction(self):
        assert self.target.forces.direction == [0, 0, 0]

    def test_vector_impacts_yaw_negatively(self):
        assert 0 > self.target.yaw_momentum

    def test_vector_does_not_move_object(self):
        x, y, z = self.target.translation_forces()
        assert 0 == round(x, 6)
        assert 0 == round(y, 6)
        assert -1 == round(z, 6)