Rotate a point by another point in 2D

前端 未结 3 1502
天命终不由人
天命终不由人 2020-11-29 01:13

I want to know how to work out the new co-ordinates for a point when rotated by an angle relative to another point.

I have a block arrow and want to rotate it by an

3条回答
  •  温柔的废话
    2020-11-29 01:43

    If you have the System.Windows.Media namespace available, then you can use the built in transformations:

        using System.Windows.Media;
    
        var transform = new RotateTransform() {Angle = angleInDegrees, CenterX = center.X, CenterY = center.Y};
        var transformedPoint = transform.Transform(point);
    

提交回复
热议问题