So, we've forever had DISTANCE TO, which measures from the rotation center of one sprite to the rotation center of the other, paying no attention to what direction they're facing.
RAY LENGTH measures the distance from the rotation center of the current (asking) sprite to the nearest edge of the other sprite, going in the direction in which the first sprite is facing.
Okay, about ATAN2: If you've studied trig, skip to the next paragraph. Think about the slope of a line. For example, a tilted roof, which they use in building houses so that rainwater doesn't collect on the roof and end up leaking into the house. A roof can be really pointy, or it can be nearly flat, or anything in between. Slope is a measure of how pointy it is. As you walk from the bottom of the roof to the top, the slope is the ratio of how much higher off the ground you are (Δy, the change in y) divided by how much distance parallel to ther ground you walked, from the outer edge of the house to the middle (supposing that's where it peaks), Δx. Another way to think about the slope of the roof is to ask what angle it makes with the horizontal. So, for a flat roof it's 0°; if you imagine a vertical roof, the angle would be 90°. There are two functions, inverses of each other, that relate the two measures, slope and angle:
slope = tan(angle); angle = arctan(slope). "Tan" is short for "tangent"; "arctan" is short for "arctangent." "Arctan" is how mathematicians write it; computer programmers, who are notoriously lazy, spell it "atan." Tan and atan are two of the options in the huge menu of functions in the SQRT OF block.
Now think about that hypothetical vertical roof. Its slope, Δy/Δx, is infinite, because no matter how much you walk vertically, you stay in the same place horizontally. But it has a perfectly well-defined, finite angle: 90°.
Okay, now, you're doing some computer graphics. You have two points, and you want to get from one to the other. What you know is the X POSITION and Y POSITION of each of the two points, and you want to know the angle. (Why do you want that? Just trust me, that's often what people want.) So you write
Right? Make sure you believe that before we go on.
This formula works great, unless the two points happen to be one directly above the other. In that case, the difference between the X positions is 0, so the quotient is infinite. So you don't write that. Instead you write
which means, divide the first input by the second input and take the arctangent, unless the second input is zero, in which case report 90 if the first input is positive or -90 if the first input is negative. That's atan2.
All of the above is the story out in the real world, where angles are measured counterclockwise from East, and where negative numbers are frowned upon. The details are a little different in Snap!. Because we measure angles from vertical rather than from horizontal, it turns out that our slopes are Δx/Δy instead of Δy/Δx. So our atan2 takes the horizontal distance in the first input and the vertical distance in the second input. And also, it turns out that our ATAN function has its domain extended to include ∞ and -∞, returning 90 and -90 respectively. So our users don't have to use atan2 at all. But if you're trying to translate code from some other language, it's there if you need it.
About hiding these functions behind RELABEL: It's sort of a compromise. Users want every function that you'd find in any other programming language, and they're right, so we want to provide them. But on the other hand, we're about teaching computer science, not math, so the actual writing of those functions, especially max and min, are great exercises kids shouldn't lose. So this is an experiment in having our cake and eating it too.