|
@@ -2,6 +2,7 @@
|
|
|
using NPOI.SS.UserModel.Charts;
|
|
|
using NPOI.SS.Util;
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
+using OTSCLRINTERFACE;
|
|
|
using OTSCommon.DBOperate.Model;
|
|
|
|
|
|
using OTSIncAReportApp;
|
|
@@ -2847,6 +2848,36 @@ namespace OTSIncAReportGrids
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ private double GetCosValue(CPosXrayClr posXray, CPosXrayClr posXray1)
|
|
|
+ {
|
|
|
+ if (posXray == null) return 0;
|
|
|
+ if (posXray1 == null) return 0;
|
|
|
+ if (posXray.GetChannelsNum() != posXray1.GetChannelsNum())
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ var pXrayData = posXray.GetXrayData();
|
|
|
+ var pXrayData1 = posXray1.GetXrayData();
|
|
|
+
|
|
|
+
|
|
|
+ // 公式: (x1y1+x2y2+x3y3+...x2000y2000) / (sqrt(x1^2 + x2^2 + ...x2000^2) * sqrt(y1^2 + y2^2 + ...y2000^2))
|
|
|
+ double dotProduct = 0;
|
|
|
+ double d1 = 0;
|
|
|
+ double d2 = 0;
|
|
|
+ for (int i = 0; i < posXray.GetChannelsNum(); i++)
|
|
|
+ {
|
|
|
+ double r1 = pXrayData[i];
|
|
|
+ double r2 = pXrayData1[i];
|
|
|
+ r1 *= r2;
|
|
|
+ dotProduct = dotProduct + r1;
|
|
|
+
|
|
|
+ }
|
|
|
+ d1 = posXray.GetXrayDataVectorNorm();
|
|
|
+ d2 = posXray1.GetXrayDataVectorNorm();
|
|
|
+ return (0 == d1 || 0 == d2) ? 0 : dotProduct / (d1 * d2);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|