指向矢量方向的箭头

Point arrow in vector direction

我试图将箭头指向矢量的方向(在本例中是风),但我完全迷路了。

这是我目前所做的:

PVector wind = new PVector(0.01, 0.00);
float degrees = atan(wind.y / wind.x);
rotate(radians(degrees));
// draw an upwards pointing arrow

我不是数学天才;甚至不确定度数是否正确,但这是我在互联网上能找到的唯一公式。

我想到了一些东西(在这个线程的帮助下,https://processing.org/discourse/beta/num_1219607845.html)。

noStroke();
fill(0);
rotate(atan2(location.x, location.y));
ellipse(location.x, location.y, 10, 10);
triangle(location.x - -5, location.y + 0, location.x - 5, location.y + 0, location.x - 0, location.y - 10);