float point_distance(float x1, float y1, float x2, float y2) { float dx = x2 - x1; float dy = y2 - y1; float inner = sq(dx) + sq(dy); float result = sqrt(inner); return result; } float[] move_in_direction(float startx, float starty, float direction, float distance) { float newx = startx + cos(radians(direction)) * distance; float newy = starty - sin(radians(direction)) * distance; float[] result = {newx, newy}; return result; } float point_direction(float x1, float y1, float x2, float y2) { float dx = x2 - x1; float dy = y2 - y1; float direction = degrees(atan2(-dy, dx)); return direction; }