diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs index 3a6de69f..a9ea34e6 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/Utility/MapPoint.cs @@ -134,6 +134,31 @@ namespace CampusAppWPortalLib8.Model.Utility return false; } + /// Rotate degrees. + /// Fiedler, 13.11.2013. + /// The fix point. + /// The angle degrees. positive values -> counterclockwise rotation. + /// A MapPoint. + public MapPoint RotateDeg(MapPoint fixPoint, double angleDeg) + { + return this.Rotate(fixPoint, angleDeg * (Math.PI / 180)); + } + + /// Rotates. + /// Fiedler, 13.11.2013. + /// The fix point. + /// The angle radians. positive values -> counterclockwise rotation. + /// A MapPoint. + 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 } }