Rotation functions added
This commit is contained in:
@@ -134,6 +134,31 @@ namespace CampusAppWPortalLib8.Model.Utility
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary> Rotate degrees. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="fixPoint"> The fix point. </param>
|
||||
/// <param name="angleDeg"> The angle degrees. positive values -> counterclockwise rotation.</param>
|
||||
/// <returns> A MapPoint. </returns>
|
||||
public MapPoint RotateDeg(MapPoint fixPoint, double angleDeg)
|
||||
{
|
||||
return this.Rotate(fixPoint, angleDeg * (Math.PI / 180));
|
||||
}
|
||||
|
||||
/// <summary> Rotates. </summary>
|
||||
/// <remarks> Fiedler, 13.11.2013. </remarks>
|
||||
/// <param name="fixPoint"> The fix point. </param>
|
||||
/// <param name="angleRad"> The angle radians. positive values -> counterclockwise rotation.</param>
|
||||
/// <returns> A MapPoint. </returns>
|
||||
public MapPoint Rotate(MapPoint fixPoint, double angleRad)
|
||||
{
|
||||
MapPoint retValue = new MapPoint(0, 0);
|
||||
|
||||
retValue.X = fixPoint.X + (this.X - fixPoint.X) * Math.Cos(angleRad) - (this.Y - fixPoint.Y) * Math.Sin(angleRad);
|
||||
retValue.Y = fixPoint.Y + (this.X - fixPoint.X) * Math.Sin(angleRad) + (this.Y - fixPoint.Y) * Math.Cos(angleRad);
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user