public GameAngle GetAngle(Vector2D target) { var radianAngle = MathHelper.Atan2(target._y, target._x) - MathHelper.Atan2(_y, _x); var degreeAngle = radianAngle.ToDegrees(); return(GameAngle.FromDegrees(degreeAngle)); }
public Point2D Rotate(Point2D center, GameAngle angle) { float cos, sin; angle.CosSin(out cos, out sin); return(RotatePointInternal(this, center, cos, sin)); }
/// <summary> /// Initializes a new instance of the <see cref="DirectionalPosition"/> class. /// </summary> public DirectionalPosition(IDirectionalPosition directionalPosition) { #region Argument Check if (directionalPosition == null) { throw new ArgumentNullException("directionalPosition"); } #endregion _position = directionalPosition.Position; _angle = directionalPosition.Angle; }
public static Point2D[] Rotate(IEnumerable <Point2D> values, Point2D center, GameAngle angle) { #region Argument Check if (values == null) { throw new ArgumentNullException("values"); } #endregion float cos, sin; angle.CosSin(out cos, out sin); return(values.Select(value => RotatePointInternal(value, center, cos, sin)).ToArray()); }
/// <summary> /// Initializes a new instance of the <see cref="DirectionalPosition"/> structure. /// </summary> public DirectionalPosition(Point2D position, GameAngle angle) { _position = position; _angle = angle; }