개정판 3b797b23
Fix: CircleControl 회전 적용 중...
Change-Id: I4711f5cc93af7158369d745d9efa765491060841
KCOM/Common/MathHelper.cs | ||
---|---|---|
11 | 11 |
public static class MathHelper |
12 | 12 |
{ |
13 | 13 |
|
14 |
/// <summary> |
|
15 |
/// p2를 기준으로 p1을 angle만큼 회전시킨다. |
|
16 |
/// </summary> |
|
17 |
/// <param name="p1"></param> |
|
18 |
/// <param name="p2"></param> |
|
19 |
/// <param name="angle">in degree</param> |
|
20 |
/// <returns></returns> |
|
14 | 21 |
public static Point RotatePoint(Point p1, Point p2, double angle) |
15 | 22 |
{ |
16 |
|
|
17 |
//double radians = ConvertToRadians(angle); |
|
18 |
//double sin = Math.Sin(radians); |
|
19 |
//double cos = Math.Cos(radians); |
|
20 |
|
|
21 |
//// Translate point back to origin |
|
22 |
//p1.X -= p2.X; |
|
23 |
//p1.Y -= p2.Y; |
|
24 |
|
|
25 |
//// Rotate point |
|
26 |
//double xnew = p1.X * cos - p1.Y * sin; |
|
27 |
//double ynew = p1.X * sin + p1.Y * cos; |
|
28 |
|
|
29 |
//// Translate point back |
|
30 |
//Point newPoint = new Point((int)xnew + p2.X, (int)ynew + p2.Y); |
|
31 |
|
|
32 |
|
|
33 | 23 |
var transform = new RotateTransform() { Angle = angle, CenterX = p2.X, CenterY = p2.Y }; |
34 | 24 |
var transformedPoint = transform.Transform(p1); |
35 | 25 |
|
내보내기 Unified diff