Referenced from lesson The Distance Formula

The distance between x_1 and x_2 is computed by (line-length x1 x2). The distance between y_1 and y_2 is computed by (line-length y1 y2). Below is the equation to compute the hypotenuse of a right triangle with those amount for legs:

√( line\mbox-length(x_1, x_2)^2 + line\mbox-length(y_1, y_2)^2 )

Suppose your player is at (0, 2) and a character is at (4, 5). What is the distance between them? With your pencil, label which numbers represent x_1, y_1, x_2 and x_y. The equation to compute the distance between these points is:

√( line\mbox-length(0, 4)^2 + line\mbox-length(2, 5)^2 )

1. Translate the expression above, for (0,2) and (4,5) into a Circle of Evaluation below.

 

🖼Show image

 

2. Convert the Circle of Evaluation to Code below.

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, and 1738598). CCbadge Bootstrap:Algebra by Emmanuel Schanzer, Jen Poole, Ed Campos Jr, Flannery Denny, and Dorai Sitaram is licensed under a Creative Commons 4.0 Unported License. Based on a work at www.BootstrapWorld.org. Permissions beyond the scope of this license may be available by contacting schanzer@BootstrapWorld.org.