public double Half_interval(FunctionX F, double a, double b, double E) { Half = GetHalf; double c = Half(a, b); if (F(a) * F(b) > 0) { throw new Exception("Возможно, на этом отрезке нет корней"); } while (Math.Abs(b - a) > E) { c = Half(a, b); if (F(c) == 0) { return(c); //Корень уравнения } else { if (F(c) * F(a) < 0) { b = c; } else { a = c; } } } if (Math.Abs(F(a)) <= E) //выбор приближенного значения { return(a); } else { return(b); } }
public override string ToString() { return(string.Format($"{PointIn.PadRight(20, ' ')}{ PointOut.PadRight(20, ' ')}{(IsRunning ? "运行中 " : "启动失败")}{ConnectCount.ToString().PadRight(10, ' ')}{SizeSuffix(ReceiveBytes)}/{SizeSuffix(SendBytes)}")); }
private void MarkHighCurvEdges(ref Cl3DModel Model) { Cl3DModel.Cl3DModelPointIterator NoseTip = Model.GetSpecificPoint(Cl3DModel.eSpecificPoints.NoseTip); Cl3DModel.Cl3DModelPointIterator LeftEye = Model.GetSpecificPoint(Cl3DModel.eSpecificPoints.LeftEyeRightCorner); Cl3DModel.Cl3DModelPointIterator RightEye = Model.GetSpecificPoint(Cl3DModel.eSpecificPoints.RightEyeLeftCorner); float diistance = (float)Math.Sqrt(Math.Pow(NoseTip - LeftEye, 2) + Math.Pow(NoseTip - RightEye, 2) + Math.Pow(LeftEye - RightEye, 2)) * 1.15f; List <Cl3DModel.Cl3DModelPointIterator> pointsIn = new List <Cl3DModel.Cl3DModelPointIterator>(); Cl3DModel.Cl3DModelPointIterator iter = Model.GetIterator(); do { float dist = (float)Math.Sqrt(Math.Pow((float)(iter - NoseTip), 2) + Math.Pow((float)(iter - LeftEye), 2) + Math.Pow((float)(iter - RightEye), 2)); if (dist < diistance) { pointsIn.Add(iter.CopyIterator()); } } while (iter.MoveToNext()); double MaxK1_10 = double.MinValue; double MinK1_10 = double.MaxValue; double MaxK1_15 = double.MinValue; double MinK1_15 = double.MaxValue; double MaxK1_20 = double.MinValue; double MinK1_20 = double.MaxValue; double MaxK1_25 = double.MinValue; double MinK1_25 = double.MaxValue; double MaxK1_55 = double.MinValue; double MinK1_40 = double.MaxValue; foreach (Cl3DModel.Cl3DModelPointIterator PointIn in pointsIn) { double valK1_10; if (!PointIn.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_10, out valK1_10)) { ClInformationSender.SendInformation("K1 10 unavailable for the point " + PointIn.PointID.ToString(), ClInformationSender.eInformationType.eDebugText); continue; } double valK1_15; if (!PointIn.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_15, out valK1_15)) { ClInformationSender.SendInformation("K1 15 unavailable for the point " + PointIn.PointID.ToString(), ClInformationSender.eInformationType.eDebugText); continue; } double valK1_20; if (!PointIn.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_20, out valK1_20)) { ClInformationSender.SendInformation("K1 20 unavailable for the point " + PointIn.PointID.ToString(), ClInformationSender.eInformationType.eDebugText); continue; } double valK1_25; if (!PointIn.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_25, out valK1_25)) { ClInformationSender.SendInformation("K1 25 unavailable for the point " + PointIn.PointID.ToString(), ClInformationSender.eInformationType.eDebugText); continue; } double valK1_40; if (!PointIn.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_40, out valK1_40)) { ClInformationSender.SendInformation("K1 40 unavailable for the point " + PointIn.PointID.ToString(), ClInformationSender.eInformationType.eDebugText); continue; } if (MinK1_10 > valK1_10) { MinK1_10 = valK1_10; } if (MaxK1_10 < valK1_10) { MaxK1_10 = valK1_10; } if (MinK1_15 > valK1_15) { MinK1_15 = valK1_15; } if (MaxK1_15 < valK1_15) { MaxK1_15 = valK1_15; } if (MinK1_20 > valK1_20) { MinK1_20 = valK1_20; } if (MaxK1_20 < valK1_20) { MaxK1_20 = valK1_20; } if (MinK1_25 > valK1_25) { MinK1_25 = valK1_25; } if (MaxK1_25 < valK1_25) { MaxK1_25 = valK1_25; } if (MinK1_40 > valK1_40) { MinK1_40 = valK1_40; } if (MaxK1_55 < valK1_40) { MaxK1_55 = valK1_40; } } iter = Model.GetIterator(); do { double valK1_10; if (!iter.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_10, out valK1_10)) { continue; } double valK1_15; if (!iter.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_15, out valK1_15)) { continue; } double valK1_20; if (!iter.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_20, out valK1_20)) { continue; } double valK1_25; if (!iter.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_25, out valK1_25)) { continue; } double valK1_40; if (!iter.GetSpecificValue(Cl3DModel.Cl3DModelPointIterator.eSpecificValues.K1_40, out valK1_40)) { continue; } if (valK1_10 < MinK1_10 || valK1_10 > MaxK1_10 || valK1_15 < MinK1_15 || valK1_15 > MaxK1_15 || valK1_20 < MinK1_20 || valK1_20 > MaxK1_20 || valK1_25 < MinK1_25 || valK1_25 > MaxK1_25 || valK1_40 < MinK1_40 || valK1_40 > MaxK1_55 ) { // iter.Color = Color.LightBlue; iter.AddSpecificValue("ToRemove_HighCurvature", 1.0f); } } while (iter.MoveToNext()); }
private void Awake() { InPoint = GetComponentInChildren <PointIn>(); }