/// <summary> /// Rotates the specified vector. /// </summary> /// <param name="vector">The vector.</param> /// <param name="angle">The angle.</param> public static Vector2 Rotate(Vector2 vector, float angle) { float rx = vector.X * MathHelper.Cos(angle) - vector.Y * MathHelper.Sin(angle); float ry = vector.X * MathHelper.Sin(angle) + vector.Y * MathHelper.Cos(angle); return(new Vector2(rx, ry)); }
/// <summary> /// Updates the Ellipse if something changed. /// </summary> private void UpdateEllipse() { var points = new List <Vector2>(); for (int i = 1; i <= 360; i++) { points.Add(new Vector2(RadiusX * MathHelper.Cos(i * (float)MathHelper.PiOverOneEighty) + _position.X, RadiusY * MathHelper.Sin(i * (float)MathHelper.PiOverOneEighty) + _position.Y)); } _polygon = new Polygon(points.ToArray()); }