/// <summary> /// Explicit Constructor. Set the Position2D object that should be affected by rotations around /// this Pivot Point. /// </summary> /// <param name="cPosition">Handle to the Position2D object to update</param> public PivotPoint2D(Position2D cPosition) { // Save a handle to the Position that this should update mcPositionData = cPosition; // Set the handle to the Orientation to null so no Orientation operations are performed mcOrientationData = null; }
/// <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> /// Copies the given PivotPoint2D object's data into this object's data /// </summary> /// <param name="cPivotPointToCopy"></param> public void CopyFrom(PivotPoint2D cPivotPointToCopy) { PivotPoint = cPivotPointToCopy.PivotPoint; PivotRotationalVelocity = cPivotPointToCopy.PivotRotationalVelocity; PivotRotationalAcceleration = cPivotPointToCopy.PivotRotationalAcceleration; mbRotateOrientationToo = cPivotPointToCopy.RotateOrientationToo; mcPositionData = new Position2D(cPivotPointToCopy.PositionData); mcOrientationData = new Orientation2D(cPivotPointToCopy.OrientationData); }
/// <summary> /// Copies the given Orientation2D object's data into this object's data. /// </summary> /// <param name="orientationToCopy">The Orientation2D object to copy from.</param> public override void CopyFrom(Orientation2D orientationToCopy) { base.CopyFrom(orientationToCopy); PreviousOrientation = Orientation; UpdatePreviousOrientationAutomatically = true; }
/// <summary> /// Copy Constructor. /// </summary> /// <param name="orienationToCopy">The Orientation2D object to copy.</param> public Orientation2DWithPreviousOrientation(Orientation2D orienationToCopy) { CopyFrom(orienationToCopy); }
/// <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); }
/// <summary> /// Copies the given Orientation2D object's data into this object's data /// </summary> /// <param name="cOrientationToCopy">The Orientation2D object to copy from</param> public virtual void CopyFrom(Orientation2D cOrientationToCopy) { Orientation = cOrientationToCopy.Orientation; RotationalVelocity = cOrientationToCopy.RotationalVelocity; RotationalAcceleration = cOrientationToCopy.RotationalAcceleration; }
/// <summary> /// Copy Constructor /// </summary> /// <param name="cOrienationToCopy">The Orientation2D object to copy</param> public Orientation2D(Orientation2D cOrienationToCopy) { CopyFrom(cOrienationToCopy); }
/// <summary> /// Explicit Constructor. Set the Position2D and Orientation2D objects that should be affected by /// rotational around this Pivot Point. /// </summary> /// <param name="cPosition">Handle to the Position2D object to update</param> /// <param name="cOrientation">Handle to the Orienetation2D object to update</param> public PivotPoint2D(Position2D cPosition, Orientation2D cOrientation) { // Save handles to the Position and Orientation that this should update mcPositionData = cPosition; mcOrientationData = cOrientation; }