Changeset 8602
 Timestamp:
 Feb 8, 2020, 1:34:07 PM (2 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/CrypPlugins/Primes/Primes/WpfControls/Threads/FunctionThread.cs
r8600 r8602 71 71 72 72 PrimesBigInteger i = m_From; 73 while (i.CompareTo(fe.Range.To + inci  1) <= 0 && !HasTerminateRequest()) 74 //for (long i = m_From; i <= fe.Range.To * factor  !HasTerminateRequest(); i += inci) 73 while (inci > 0 && i.CompareTo(fe.Range.To) <= 0 && !HasTerminateRequest()) 75 74 { 76 75 Boolean awokenByTerminate = SuspendIfNeeded(); … … 97 96 98 97 double x2 = x1 + double.Parse(incX.ToString()); 98 99 99 if (fe.Function.DrawTo.Equals(double.PositiveInfinity)  x2 <= fe.Function.DrawTo) 100 100 { 101 if (fe.FunctionType == FunctionType.STAIR)102 {103 if (!formerY.Equals(y))104 {105 x2 = double.Parse(incX.ToString());106 }107 }108 101 if (!DrawLine(x1, x2, formerY, y, fe.Color, fe.Function)) break; 109 110 if (fe.FunctionType == FunctionType.STAIR)111 {112 if (!formerY.Equals(y))113 {114 x2 += double.Parse(incX.ToString());115 if (!DrawLine(x1, x2, y, y, fe.Color, fe.Function)) break;116 }117 }118 102 } 119 103 120 104 x1 = x2; 121 105 } 106 107 if (i.Add(inci).CompareTo(fe.Range.To) > 0) 108 { 109 inci = fe.Range.To.Subtract(i); 110 incX = inci; 111 } 112 122 113 i = i.Add(inci); 123 114 } … … 144 135 145 136 PrimesBigInteger i = m_From; 146 while (i .CompareTo(fe.Range.To) <= 0 && !HasTerminateRequest())137 while (inci > 0 && i.CompareTo(fe.Range.To) <= 0 && !HasTerminateRequest()) 147 138 { 148 139 Boolean awokenByTerminate = SuspendIfNeeded(); … … 155 146 156 147 double param = i.DoubleValue; 148 if (fe.Function.FormerValue.Equals(double.NaN)) 149 { 150 try 151 { 152 fe.Function.Execute(param); 153 } 154 catch (ResultNotDefinedException) { x1 += double.Parse(incX.ToString()); continue; } 155 } 156 else 157 { 158 double formerY = fe.Function.FormerValue; 159 double y = fe.Function.Execute(param); 157 160 158 double formerY = fe.Function.FormerValue; 159 double y = fe.Function.Execute(param); 161 bool drawstair = !formerY.Equals(y)  formerY.Equals(double.NaN); 162 if (formerY.Equals(double.NaN)) formerY = y; 163 double x2 = x1 + double.Parse(incX.ToString()); 164 if (fe.Function.DrawTo.Equals(double.PositiveInfinity)  (x2 <= fe.Function.DrawTo && x2 <= fe.Range.To.DoubleValue)) 165 { 166 if (drawstair) 167 { 168 x2 = double.Parse(incX.ToString()); 169 } 170 if (!DrawLine(x1, x2, formerY, y, fe.Color, fe.Function)) break; 171 if (drawstair) 172 { 173 x2 += double.Parse(incX.ToString()); 174 if (!DrawLine(x1, x2, y, y, fe.Color, fe.Function)) break; 175 } 176 } 160 177 161 bool drawstair = !formerY.Equals(y)  formerY.Equals(double.NaN); 162 if (formerY.Equals(double.NaN)) formerY = y; 163 double x2 = x1 + double.Parse(incX.ToString()); 164 if (fe.Function.DrawTo.Equals(double.PositiveInfinity)  (x2 <= fe.Function.DrawTo && x2 <= fe.Range.To.DoubleValue)) 165 { 166 if (drawstair) 167 { 168 x2 = double.Parse(incX.ToString()); 169 } 170 if (!DrawLine(x1, x2, formerY, y, fe.Color, fe.Function)) break; 171 if (drawstair) 172 { 173 x2 += double.Parse(incX.ToString()); 174 if (!DrawLine(x1, x2, y, y, fe.Color, fe.Function)) break; 175 } 178 x1 = x2; 176 179 } 177 180 178 x1 = x2; 181 if (i.Add(inci).CompareTo(fe.Range.To) > 0) 182 { 183 inci = fe.Range.To.Subtract(i); 184 incX = inci; 185 } 179 186 i = i.Add(inci); 180 187 }
Note: See TracChangeset
for help on using the changeset viewer.