MapAround.CoordinateSystems.Transformations.Affine.RotationAt C# (CSharp) Method

RotationAt() public static method

Create a transform of rotation at the specified point.
public static RotationAt ( ICoordinate coordinate, double angle ) : Affine
coordinate ICoordinate Center of rotation
angle double An angle (in radians) of rotation
return Affine
        public static Affine RotationAt(ICoordinate coordinate, double angle)
        {
            Matrix matrix = new Matrix(
                new double[,]
            {
                { 1,             0,             0},
                { 0,             1,             0},
                { -coordinate.X, -coordinate.Y, 1},
            });


            matrix = matrix.Multiply(new Matrix(
                new double[,]
            {
                { Math.Cos(angle), Math.Sin(angle), 0},
                { -Math.Sin(angle),  Math.Cos(angle), 0},
                { 0,                0,               1},
            }));

            matrix = matrix.Multiply(new Matrix(
            new double[,]
            {
                { 1,             0,             0},
                { 0,             1,             0},
                { coordinate.X, coordinate.Y, 1},
            }));
            return new Affine(matrix);
        }