Source: VelocityFieldPoint.js

/**
 * Entry of a VelocityField
 * @param {number} xPos - x position
 * @param {number} yPos - y position
 * @param {number} dirX - x direction
 * @param {number} dirY - y direction
 * @param {number} velocity - velocity at this position
 * @constructor
 */
var VelocityFieldPoint = function (xPos, yPos, dirX, dirY, velocity) {
	this.xPos = xPos;
    this.yPos = yPos;
    this.dirX = dirX;
    this.dirY = dirY;
    this.velocity = velocity;

    var parent = this;

    this.rotateWindDirection = function(degrees) {
        var radians = -degrees * (Math.PI/180);
        var cos = Math.cos(radians);
        var sin = Math.sin(radians);

        parent.dirX = Math.round(10000*(parent.dirX * cos - parent.dirY * sin))/10000;
        parent.dirY = Math.round(10000*(parent.dirX * sin + parent.dirY * cos))/10000;
    };
}