CSCI 107 Assignment 5


Problem: Determine Distance of Robot Arm Movement

When working with robots, it is often important to know how far apart two points in 3-dimensional space are so that the time to move a robot arm can be estimated. A formula on this page shows how to calculate the distance between two 3-dimensional points.

For this assignment, points in 3-dimensions will be identified by (1) their octant, (2) their x value, (3) their y value and (4) their z value. Because the octant is given, the x, y and z values will always be positive. The octants are as follows:

Learning Outcomes

Assignment

Grading - 100 points

Test Data with Expected Output

def test_suite():
    calculate_distance(1, 5, 10, 15, 1, 5, 10, 15)
    calculate_distance(1, 5, 10, 15, 2, 5, 10, 15)
    calculate_distance(1, 5, 10, 15, 3, 5, 10, 15)
    calculate_distance(1, 5, 10, 15, 4, 5, 10, 15)
    calculate_distance(1, 5, 10, 15, 5, 5, 10, 15)
    calculate_distance(1, 5, 10, 15, 6, 5, 10, 15)
    calculate_distance(7, 5, 10, 15, 1, 5, 10, 15)
    calculate_distance(8, 5, 10, 15, 1, 5, 10, 15)

The correct output is

Distance from (5,10,15) to (5,10,15) = 0.00 units
Distance from (5,10,15) to (5,10,-15) = 30.00 units
Distance from (5,10,15) to (5,-10,15) = 20.00 units
Distance from (5,10,15) to (5,-10,-15) = 36.06 units
Distance from (5,10,15) to (-5,10,15) = 10.00 units
Distance from (5,10,15) to (-5,10,-15) = 31.62 units
Distance from (-5,-10,15) to (5,10,15) = 22.36 units
Distance from (-5,-10,-15) to (5,10,15) = 37.42 units