class CircleArrow {
float x; // 원의 x 좌표
float y; // 원의 y 좌표
float r; // 원의 반지름
float tx; // 마우스 방향 원 위의 점 x 좌표, target x
float ty; // 마우스 방향 원 위의 점 y 좌표, target y
float ta; // 원의 원점에서 마우스 방향 각도, target angle
CircleArrow(float posX, float posY, float diameter) {
x = posX;
y = posY;
r = diameter / 2;
tx = 0;
ty = 0;
ta = 0;
}
void show(float targetX, float targetY) {
ta = atan2(targetY - y, targetX - x);
tx = x + cos(ta) * r;
ty = y + sin(ta) * r;
circle(x, y, r * 2);
line(x, y, tx, ty);
}
}