Answer:
When we have two vectors:
A = (a1, a2)
B = (b1, b2)
The distance between these two vectors is:
D = √( (a1 - b1)^2 + (a2 - b2)^2)
In this case, the vectors are:
U = (38, 22) and W = (55, 30)
The distance between U and W is:
D = √( (38 - 55)^2 + (22 - 30)^2 )
D = √( 289 + 64) = √353 = 18.7882
We want to round it to the nearest thousandths (the third digit to the right of the decimal point).
Then we must look at the next one (the fourth)
if the fourth digit is 5 or smaller, we round down
if the fourth digit is larger than 5, we round up.
We can see that in 18.7882 the fourth digit after the decimal point is a 2, so we round down, then the distance between U and W is:
D = 18.788
Now i guess that you want a line that connects U with W so the robot can follow it,
To find the line you can use a linear relation:
A linear relationship can be written as:
y = a*x + b
where a is the slope and b is the y-axis intercept.
For a line that passes through the points (x1, y1) and (x2, y2), the slope can be written as:
a = (y2 - y1)/(x2 - x1).
So we want a line that passes through the points U and W, the slope of this line will be:
a = (30 - 22)/(55 - 38) = 0.47
Then the equation is:
y = 0.47*x + b
to find the value of b, we know that this line passes through the point (38,22) then:
y = 22 = 0.47*38 + b
b = 22 - 0.37*38 = 7.94
The line that can use the robot to go from U to W is:
y = 0.47*x + 7.94