def test_GIVEN_movement_45_to_z_at_beam_angle_along_z_WHEN_get_intercept_THEN_position_is_initial_position( self, angle): y = 0 z = 10 movement = LinearMovement(y, z, 45) beam = PositionAndAngle(0, 0, angle) result = movement.calculate_interception(beam) assert_that(result, is_(position(Position(y, z))))
def test_GIVEN_movement_perpendicular_to_z_at_beam_angle_0_WHEN_get_intercept_THEN_position_is_initial_position( self): y = 0 z = 10 movement = LinearMovement(y, z, 90) beam = PositionAndAngle(0, 0, 0) result = movement.calculate_interception(beam) assert_that(result, is_(position(Position(y, z))))
def test_GIVEN_movement_anti_perpendicular_to_z_at_beam_angle_10_WHEN_get_intercept_THEN_position_is_z_as_initial_y_as_right_angle_triangle( self): y = 0 z = 10 beam_angle = 10 movement = LinearMovement(y, z, -90) beam = PositionAndAngle(0, 0, beam_angle) expected_y = z * tan(radians(beam_angle)) result = movement.calculate_interception(beam) assert_that(result, is_(position(Position(expected_y, z))))
def test_GIVEN_movement_0_to_z_and_beam_angle_45_WHEN_get_intercept_THEN_position_is_on_movement_axis( self): y = 20 z = 10 movement = LinearMovement(y, z, 0) beam = PositionAndAngle(0, 0, 45) expected_y = y expected_z = y result = movement.calculate_interception(beam) assert_that(result, is_(position(Position(expected_y, expected_z))))
def test_GIVEN_movement_20_to_z_and_beam_angle_45_WHEN_get_intercept_THEN_position_is_on_movement_axis( self): beam = PositionAndAngle(0, 0, 45) expected_y = 4 expected_z = 4 move_angle = 20 move_z = 2 move_y = expected_y - (expected_z - move_z) * tan(radians(move_angle)) movement = LinearMovement(move_y, move_z, move_angle) result = movement.calculate_interception(beam) assert_that(result, is_(position(Position(expected_y, expected_z))))