Add function trace

This commit is contained in:
Иван Ивашкин
2024-12-20 15:24:03 +05:00
parent 7996bd7a3d
commit ceefe3dbca
12 changed files with 80 additions and 40 deletions

View File

@@ -1,4 +1,5 @@
using LiveCharts;
using FunctionParser;
using LiveCharts;
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
@@ -25,11 +26,15 @@ namespace StructureHelperCommon.Models.Functions.Decorator
}
public override double GetByX(double xValue)
{
double yValue = 0;
if (xValue >= leftBound && xValue <= rightBound)
{
return base.GetByX(xValue);
yValue = base.GetByX(xValue);
}
return 0;
Trace = string.Empty;
Trace += $"Lim X: {Name}, Input: {xValue}, Output: {xValue};\n";
Trace += base.GetTrace();
return yValue;
}
public override GraphSettings GetGraphSettings()
{
@@ -49,5 +54,9 @@ namespace StructureHelperCommon.Models.Functions.Decorator
graphSettings.GraphPoints = graphLimitGraphPoint;
return graphSettings;
}
public override string GetTrace()
{
return Trace;
}
}
}

View File

@@ -25,19 +25,24 @@ namespace StructureHelperCommon.Models.Functions.Decorator
}
public override double GetByX(double xValue)
{
double retValue = 0;
var y = base.GetByX(xValue);
if (y > downBound && y < upBound)
{
return y;
retValue = y;
}
else if (y <= downBound)
{
return downBound;
retValue = downBound;
}
else
{
return upBound;
retValue = upBound;
}
Trace = string.Empty;
Trace += base.GetTrace();
Trace += $"Lim Y: {Name}, Input: {y}, Output: {retValue};\n";
return retValue;
}
public override GraphSettings GetGraphSettings()
{
@@ -65,5 +70,9 @@ namespace StructureHelperCommon.Models.Functions.Decorator
graphSettings.GraphPoints = graphLimitGraphPoint;
return graphSettings;
}
public override string GetTrace()
{
return Trace;
}
}
}

View File

@@ -23,7 +23,12 @@ namespace StructureHelperCommon.Models.Functions.Decorator
}
public override double GetByX(double xValue)
{
return base.GetByX(factor * xValue);
double yValue = base.GetByX(factor * xValue);
Trace = string.Empty;
Trace += $"Scale X: {Name}, Input: {xValue}, Output: {factor * xValue};\n";
Trace += base.GetTrace();
return yValue;
}
public override GraphSettings GetGraphSettings()
{
@@ -34,5 +39,9 @@ namespace StructureHelperCommon.Models.Functions.Decorator
}
return graphSettings;
}
public override string GetTrace()
{
return Trace;
}
}
}

View File

@@ -23,7 +23,13 @@ namespace StructureHelperCommon.Models.Functions.Decorator
}
public override double GetByX(double xValue)
{
return factor * base.GetByX(xValue);
double functionValue = base.GetByX(xValue);
double yValue = factor * functionValue;
Trace = string.Empty;
Trace += base.GetTrace();
Trace += $"Scale Y: {Name}, Input: {functionValue}, Output: {yValue};\n";
return yValue;
}
public override GraphSettings GetGraphSettings()
{
@@ -34,5 +40,9 @@ namespace StructureHelperCommon.Models.Functions.Decorator
}
return graphSettings;
}
public override string GetTrace()
{
return Trace;
}
}
}