/// <summary> /// Rotates the given Position and Orientation around the Pivot Point, changing the Position and Orientation /// </summary> /// <param name="fRotation">The Rotation in radians to apply to the object</param> /// <param name="sPivotPoint">The Point to rotate the object around</param> /// <param name="srPosition">The Position of the object to be modified</param> /// <param name="frOrientation">The Orientation (rotation) of the object to be modified</param> public static void RotatePositionAndOrientation(float fRotation, Vector2 sPivotPoint, ref Vector2 srPosition, ref float frOrientation) { // Rotate the Orientation about it's center to change its Orientation frOrientation = Orientation2D.Rotate(fRotation, frOrientation); // Rotate the Position around the specified Pivot Point srPosition = PivotPoint2D.RotatePosition(fRotation, sPivotPoint, srPosition); }
/// <summary> /// Rotates the object about its center, changing its Orientation, as well as around the /// specified Pivot Point, changing its Position /// </summary> /// <param name="fRotation">The Rotation in radians to apply to the object</param> /// <param name="sPivotPoint">The Point to rotate the object around</param> public void RotatePositionAndOrientation(float fRotation, Vector2 sPivotPoint) { // If we have a handle to the Orientation if (mcOrientationData != null) { // Rotate the Orientation about it's center to change its Orientation mcOrientationData.Rotate(fRotation); } // Rotate the Position around the specified Pivot Point RotatePosition(fRotation, sPivotPoint); }
/// <summary> /// Applies the given Rotation to the object's Orientation /// </summary> /// <param name="fRotation">The Rotation in radians that should be applied to the object</param> public void Rotate(float fRotation) { Orientation = Orientation2D.Rotate(fRotation, Orientation); }