test
This commit is contained in:
@@ -200,24 +200,34 @@ namespace 头罩视野.Views
|
||||
int[] lightData = DataList.Cast<int>().ToArray(); // 1. 把DataList(List<dynamic>)转成方法需要的int[]
|
||||
// 1. 定义总和变量,初始为0
|
||||
double totalArea = 0;//总面积
|
||||
double totalBottomViewAngle = 0;//总角度
|
||||
double maxBottomViewAngle = 0; ;//记录所有姿态里的最大下方视野
|
||||
// 2. 从0转到180,每 stepAngle 执行一次
|
||||
for (double current = stepAngle; current <= 180; current += stepAngle)
|
||||
{
|
||||
_ = ReadLightBarData();
|
||||
|
||||
//开始计算视野面积
|
||||
//2. 调用CalculateEllipseArea,传入两个参数
|
||||
double area = GetArea.CalculateEllipseArea(lightData, _lightPositions);
|
||||
totalArea += area;
|
||||
// 单次计算下方视野角度
|
||||
double bottomViewAngle = GetArea.CalculateBottomViewAngle(lightData, _lightPositions);
|
||||
totalBottomViewAngle += bottomViewAngle;
|
||||
|
||||
// 记录所有姿态里的最大/最小值
|
||||
if (bottomViewAngle > maxBottomViewAngle)
|
||||
{
|
||||
maxBottomViewAngle = bottomViewAngle;
|
||||
}
|
||||
// 如果你要取最小值,用下面这段
|
||||
// if (bottomViewAngle < minBottomViewAngle && bottomViewAngle > 0)
|
||||
// {
|
||||
// minBottomViewAngle = bottomViewAngle;
|
||||
// }
|
||||
}
|
||||
isFinished = _modbusMaster.ReadCoils(1, 102, 1)[0];
|
||||
if (isFinished)
|
||||
{
|
||||
Button_Click_Stop(null, null);
|
||||
UpdateVisionResults(totalArea, totalBottomViewAngle);
|
||||
UpdateVisionResults(totalArea, maxBottomViewAngle);
|
||||
}
|
||||
}
|
||||
//页面渲染值
|
||||
|
||||
Reference in New Issue
Block a user