Nez.Portable/Math/Mathf.cs
/// <summary>
/// the rotation is relative to the current position not the total rotation. For example, if you are currently at 90 degrees and
/// want to rotate to 135 degrees, you would use an angle of 45, not 135.
/// </summary>
/// <returns>The around.</returns>
/// <param name="point">Point.</param>
/// <param name="center">Center.</param>
/// <param name="angleInDegrees">Angle in degrees.</param>
the rotation is relative to the current position not the total rotation. For example, if you are currently at 90 degrees and
want to rotate to 135 degrees, you would use an angle of 45, not 135.
the rotation is relative to the current position not the total rotation . For example if you are currently at 90 degrees and want to rotate to 135 degrees you would use an angle of 45 not 135 .
[MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static Vector2 rotateAround(Vector2 point, Vector2 center, float angleInDegrees)
        {
            angleInDegrees = MathHelper.ToRadians(angleInDegrees);
            var cos = Mathf.cos(angleInDegrees);
            var sin = Mathf.sin(angleInDegrees);
            var rotatedX = cos * (point.X - center.X) - sin * (point.Y - center.Y) + center.X;
            var rotatedY = sin * (point.X - center.X) + cos * (point.Y - center.Y) + center.Y;
            return new Vector2(rotatedX, rotatedY);
        }
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ] public static Vector2 rotateAround ( Vector2 point , Vector2 center , float angleInDegrees ) { angleInDegrees = MathHelper . ToRadians ( angleInDegrees ) ; var cos = Mathf . cos ( angleInDegrees ) ; var sin = Mathf . sin ( angleInDegrees ) ; var rotatedX = cos * ( point . X - center . X ) - sin * ( point . Y - center . Y ) + center . X ; var rotatedY = sin * ( point . X - center . X ) + cos * ( point . Y - center . Y ) + center . Y ; return new Vector2 ( rotatedX , rotatedY ) ; }
the rotation is relative to the current position not the total rotation.
the rotation is relative to the current position not the total rotation .
None
point
Vector2
None
center
Vector2
None
angleInDegrees
float
Angle in degrees.
Angle in degrees .