ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / Rotate Method
The geometry to rotate. If the geometry is an Envelope, then it will be converted to a polygon.
The origin around which the geometry will be rotated.
The rotation angle in radians.
Example

In This Topic
    Rotate Method (IGeometryEngine)
    In This Topic
    Rotates the geometry about the specified origin point.
    Syntax

    Parameters

    geometry
    The geometry to rotate. If the geometry is an Envelope, then it will be converted to a polygon.
    origin
    The origin around which the geometry will be rotated.
    rotationAngle
    The rotation angle in radians.

    Return Value

    The rotated geometry. If the input geometry is an Envelope, then a polygon is returned. If the input geometry is empty, then an empty geometry is returned.
    Exceptions
    ExceptionDescription
    Either geometry or origin or both are null.
    The method is not implemented for GeometryBag.
    Incompatible spatial references between the input geometries.
    Example
    Rotate a MapPoint
    MapPoint pt = MapPointBuilderEx.CreateMapPoint(1.0, 3.0);
    MapPoint rotatePt = MapPointBuilderEx.CreateMapPoint(3.0, 3.0);
    
    Geometry result = GeometryEngine.Instance.Rotate(pt, rotatePt, Math.PI / 2);
    // result point is (3, 1)
    Rotate a Polyline
    // rotate a polyline
    
    MapPoint fixedPt = MapPointBuilderEx.CreateMapPoint(3.0, 3.0);
    
    List<MapPoint> pts = new List<MapPoint>();
    pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(1.0, 5.0));
    pts.Add(MapPointBuilderEx.CreateMapPoint(5, 5));
    pts.Add(MapPointBuilderEx.CreateMapPoint(5.0, 1.0));
    Polyline polyline = PolylineBuilderEx.CreatePolyline(pts);
    
    Polyline rotated = GeometryEngine.Instance.Rotate(polyline, fixedPt, Math.PI / 4) as Polyline;  // rotate 45 deg
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also