개정판 b643fcca
- angle event 수정
- select에서 shift키 이벤트 안됨
Change-Id: I17decc4b6ab1f91e7b6ae18751acf74811e5d7a7
MarkupToPDF/Controls/Common/MathSet.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 | 3 |
using System.Linq; |
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 | 4 |
using System.Windows; |
7 | 5 |
|
8 | 6 |
namespace MarkupToPDF.Controls.Common |
9 | 7 |
{ |
10 | 8 |
public class MathSet |
11 | 9 |
{ |
12 |
const double Rad2Deg = 180.0 / Math.PI; |
|
13 |
const double Deg2Rad = Math.PI / 180.0; |
|
14 |
const double UnitAngle = 15; |
|
10 |
private const double Rad2Deg = 180.0 / Math.PI;
|
|
11 |
private const double Deg2Rad = Math.PI / 180.0;
|
|
12 |
private const double UnitAngle = 15;
|
|
15 | 13 |
|
16 | 14 |
public static List<double> angleSet = new List<double>(); |
17 | 15 |
|
... | ... | |
32 | 30 |
double NearAngle = 0; |
33 | 31 |
double k = 0; |
34 | 32 |
|
35 |
|
|
36 | 33 |
foreach (var item in angleSet) |
37 | 34 |
{ |
38 | 35 |
double j = 0; |
... | ... | |
43 | 40 |
NearAngle = item; |
44 | 41 |
} |
45 | 42 |
k = j; |
46 |
|
|
47 | 43 |
} |
48 | 44 |
return NearAngle; |
49 | 45 |
} |
... | ... | |
65 | 61 |
(n.Y - setPoint.Y), 2 |
66 | 62 |
) |
67 | 63 |
) |
68 |
|
|
69 | 64 |
} |
70 | 65 |
).OrderBy(p => p.distance).First().n; |
71 | 66 |
|
... | ... | |
251 | 246 |
{ |
252 | 247 |
return Math.Abs(Math.Atan2(EndPoint.X - StartPoint.X, StartPoint.Y - EndPoint.Y) * Rad2Deg); |
253 | 248 |
} |
249 |
|
|
254 | 250 |
public static double DegreesToRadians(double angle) |
255 | 251 |
{ |
256 | 252 |
return ((angle * Math.PI) / 180f); |
257 | 253 |
} |
254 |
|
|
258 | 255 |
//public static double AngleMethod(double px1, double py1, double px2, double py2) |
259 | 256 |
//{ |
260 | 257 |
// return Math.Abs(Math.Atan2(px2 - px1, py1 - py2) * Rad2Deg); |
... | ... | |
290 | 287 |
|
291 | 288 |
return res; |
292 | 289 |
} |
290 |
|
|
293 | 291 |
/// <summary> |
294 | 292 |
/// return normal vector from p1 to p2 |
295 | 293 |
/// </summary> |
... | ... | |
312 | 310 |
|
313 | 311 |
return res; |
314 | 312 |
} |
313 |
|
|
315 | 314 |
public static Point FindCentroid(List<Point> pntSet) |
316 | 315 |
{ |
317 | 316 |
Double getThePointX = new Double(); |
... | ... | |
370 | 369 |
public static double CrossProduct(double x1, double y1, double x2, double y2) |
371 | 370 |
{ |
372 | 371 |
return (x1 * y2 - y1 * x2); |
373 |
|
|
374 | 372 |
} |
375 | 373 |
|
376 | 374 |
/// <summary> |
... | ... | |
416 | 414 |
} |
417 | 415 |
} |
418 | 416 |
|
419 |
|
|
420 | 417 |
/// <summary> |
421 | 418 |
/// returnAngleString을 변경하여 수정 |
422 | 419 |
/// 상단 컨트롤에 Angle값을 보여주기 위해 수정함. |
... | ... | |
438 | 435 |
angle = approxAngle; |
439 | 436 |
} |
440 | 437 |
|
438 |
if (angle < 0) |
|
439 |
{ |
|
440 |
angle = 360 + angle; |
|
441 |
} |
|
442 |
|
|
441 | 443 |
return angle; |
442 | 444 |
} |
443 | 445 |
|
... | ... | |
448 | 450 |
return MathSet.getMiddlePoint(startP, endP); |
449 | 451 |
} |
450 | 452 |
} |
451 |
} |
|
453 |
} |
내보내기 Unified diff