728x90
반응형
728x170
using System;
using System.Windows;
#region 회전하기 - Rotate(sourcePoint, angle, centerX, centerY)
/// <summary>
/// 회전하기
/// </summary>
/// <param name="sourcePoint">소스 포인트</param>
/// <param name="angle">각도</param>
/// <param name="centerX">중심 X</param>
/// <param name="centerY">중심 Y</param>
/// <returns>회전 포인트</returns>
public Point Rotate(Point sourcePoint, double angle, double centerX, double centerY)
{
double radian = angle * (Math.PI / 180d);
double targetX = Math.Cos(radian) * (sourcePoint.X - centerX) - Math.Sin(radian) * (sourcePoint.Y - centerY) + centerX;
double targetY = Math.Sin(radian) * (sourcePoint.X - centerX) + Math.Cos(radian) * (sourcePoint.Y - centerY) + centerY;
return new Point(targetX, targetY);
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Matrix 구조체 : 특정 중심을 기준으로 확장/축소 매트릭스 구하기 (0) | 2020.09.07 |
---|---|
[C#/WPF] Matrix 구조체 : 확대/축소 매트릭스 구하기 (0) | 2020.09.07 |
[C#/WPF] Martix 구조체 : 특정 중심을 기준으로 회전 매트릭스 구하기 (0) | 2020.09.07 |
[C#/WPF] Matrix 구조체 : 회전 매트릭스 구하기 (0) | 2020.09.07 |
[C#/WPF] Matrix 구조체 : 이동 매트릭스 구하기 (0) | 2020.09.07 |
[C#/WPF] Point 구조체 : 기울이기 (0) | 2020.09.07 |
[C#/WPF] Point 구조체 : 확대/축소하기 (0) | 2020.09.07 |
[C#/WPF] Point 구조체 : 이동하기 (0) | 2020.09.07 |
[C#/WPF] RotateTransform 엘리먼트 : 좌우대칭 반사 텍스트 회전하기 (0) | 2020.09.07 |
[C#/WPF] ScaleTransform 엘리먼트 : 좌우대칭 반사 텍스트 만들기 (0) | 2020.09.07 |
댓글을 달아 주세요