개정판 5e6ecf05
dev issue #000 : branch target 구하는 로직 추가(보안 필요)
Change-Id: Iac4e63f4c2cdbee58c5b7489b7d46e91c5cae942
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
130 | 130 |
} |
131 | 131 |
} |
132 | 132 |
|
133 |
public static double CalcLineToPointDistance(double lineX1, double lineY1, double lineX2, double lineY2, double x, double y) |
|
134 |
{ |
|
135 |
|
|
136 |
double distance = 0; |
|
137 |
if (lineX1 == lineX2) |
|
138 |
distance = Math.Abs(x - lineX1); |
|
139 |
else |
|
140 |
{ |
|
141 |
double a; |
|
142 |
double b; |
|
143 |
double c; |
|
144 |
|
|
145 |
a = (lineY2 - lineY1) / (lineX2 - lineX1); |
|
146 |
b = -1; |
|
147 |
c = -a * lineX1 + lineY1; |
|
148 |
|
|
149 |
distance = Math.Abs(a * x + b * y + c) / Math.Pow(a * a + b * b, 0.5); |
|
150 |
} |
|
151 |
return distance; |
|
152 |
} |
|
153 |
|
|
133 | 154 |
#region |
134 | 155 |
public static bool IsBranchLine(string UID, Line connectedLine) |
135 | 156 |
{ |
내보내기 Unified diff