About ready for 1.2.
This commit is contained in:
parent
9b4905233c
commit
f8c1788502
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.vs/
|
||||
.github/
|
||||
|
||||
Base/obj/
|
||||
Base/bin/
|
||||
|
||||
@ -12,18 +12,18 @@
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<PackageId>ThatOneNerd.Graphing</PackageId>
|
||||
<Title>ThatOneNerd.Graphing</Title>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.2.0</Version>
|
||||
<Authors>That_One_Nerd</Authors>
|
||||
<Description>A fairly adept graphing calculator made in Windows Forms.</Description>
|
||||
<Copyright>MIT</Copyright>
|
||||
<RepositoryUrl>https://github.com/That-One-Nerd/Graphing</RepositoryUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageTags>graphing;graph;plot;math;calculus;visual;desmos</PackageTags>
|
||||
<PackageTags>graphing;graph;plot;math;calculus;visual;desmos;slope field;slopefield;equation;visualizer</PackageTags>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<IncludeSymbols>True</IncludeSymbols>
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<PackageReleaseNotes>View the GitHub release for the changelog:
|
||||
https://github.com/That-One-Nerd/Graphing/releases/tag/1.1.0</PackageReleaseNotes>
|
||||
https://github.com/That-One-Nerd/Graphing/releases/tag/1.2.0</PackageReleaseNotes>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
||||
24
Base/Forms/GraphColorPickerForm.Designer.cs
generated
24
Base/Forms/GraphColorPickerForm.Designer.cs
generated
@ -43,7 +43,7 @@ namespace Graphing.Forms
|
||||
ResultView = new Panel();
|
||||
BottomPanel = new Panel();
|
||||
OkButton = new Button();
|
||||
CancelButton = new Button();
|
||||
CancellingButton = new Button();
|
||||
RgbSliders.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)BlueTrackBar).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RedTrackBar).BeginInit();
|
||||
@ -172,7 +172,7 @@ namespace Graphing.Forms
|
||||
//
|
||||
BottomPanel.BackColor = SystemColors.Window;
|
||||
BottomPanel.Controls.Add(OkButton);
|
||||
BottomPanel.Controls.Add(CancelButton);
|
||||
BottomPanel.Controls.Add(CancellingButton);
|
||||
BottomPanel.Dock = DockStyle.Bottom;
|
||||
BottomPanel.Location = new Point(0, 517);
|
||||
BottomPanel.Margin = new Padding(0);
|
||||
@ -194,15 +194,15 @@ namespace Graphing.Forms
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
CancelButton.Anchor = AnchorStyles.Right;
|
||||
CancelButton.Location = new Point(384, 9);
|
||||
CancelButton.Margin = new Padding(0);
|
||||
CancelButton.Name = "CancelButton";
|
||||
CancelButton.Size = new Size(150, 46);
|
||||
CancelButton.TabIndex = 0;
|
||||
CancelButton.Text = "Cancel";
|
||||
CancelButton.UseVisualStyleBackColor = true;
|
||||
CancelButton.Click += CancelButton_Click;
|
||||
CancellingButton.Anchor = AnchorStyles.Right;
|
||||
CancellingButton.Location = new Point(384, 9);
|
||||
CancellingButton.Margin = new Padding(0);
|
||||
CancellingButton.Name = "CancelButton";
|
||||
CancellingButton.Size = new Size(150, 46);
|
||||
CancellingButton.TabIndex = 0;
|
||||
CancellingButton.Text = "Cancel";
|
||||
CancellingButton.UseVisualStyleBackColor = true;
|
||||
CancellingButton.Click += CancelButton_Click;
|
||||
//
|
||||
// GraphColorPickerForm
|
||||
//
|
||||
@ -237,7 +237,7 @@ namespace Graphing.Forms
|
||||
private TrackBar BlueTrackBar;
|
||||
private TrackBar RedTrackBar;
|
||||
private Panel BottomPanel;
|
||||
private Button CancelButton;
|
||||
private Button CancellingButton;
|
||||
private Button OkButton;
|
||||
private TextBox RedValueBox;
|
||||
private TextBox BlueValueBox;
|
||||
|
||||
@ -63,7 +63,7 @@ public class IntegralEquation : Graphable, IIntegrable, IDerivable
|
||||
// Origin is off the left side of the screen.
|
||||
// Get to the left side from the origin.
|
||||
double start = graph.MinVisibleGraph.x, end = graph.MaxVisibleGraph.x;
|
||||
SetInternalStepper(start, epsilon, null);
|
||||
SetInternalStepper(start, epsilon);
|
||||
|
||||
// Now we can start.
|
||||
double previousX = stepX;
|
||||
@ -82,7 +82,7 @@ public class IntegralEquation : Graphable, IIntegrable, IDerivable
|
||||
// Origin is off the right side of the screen.
|
||||
// Get to the right side of the origin.
|
||||
double start = graph.MaxVisibleGraph.x, end = graph.MinVisibleGraph.x;
|
||||
SetInternalStepper(start, epsilon, null);
|
||||
SetInternalStepper(start, epsilon);
|
||||
|
||||
// Now we can start.
|
||||
double previousX = stepX;
|
||||
@ -103,7 +103,7 @@ public class IntegralEquation : Graphable, IIntegrable, IDerivable
|
||||
|
||||
// Start with right.
|
||||
double start = 0, end = graph.MaxVisibleGraph.x;
|
||||
SetInternalStepper(start, epsilon, null);
|
||||
SetInternalStepper(start, epsilon);
|
||||
|
||||
double previousX = stepX;
|
||||
double previousY = stepY;
|
||||
@ -119,7 +119,7 @@ public class IntegralEquation : Graphable, IIntegrable, IDerivable
|
||||
// Now do left.
|
||||
start = 0;
|
||||
end = graph.MinVisibleGraph.x;
|
||||
SetInternalStepper(start, epsilon, null);
|
||||
SetInternalStepper(start, epsilon);
|
||||
|
||||
previousX = stepX;
|
||||
previousY = stepY;
|
||||
@ -139,27 +139,19 @@ public class IntegralEquation : Graphable, IIntegrable, IDerivable
|
||||
|
||||
private double stepX = 0;
|
||||
private double stepY = 0;
|
||||
private void SetInternalStepper(double x, double dX, Action<double, double>? stepCallback)
|
||||
private void SetInternalStepper(double x, double dX)
|
||||
{
|
||||
stepX = 0;
|
||||
stepY = 0;
|
||||
if (usingAlt) altBaseEqu!.SetInternalStepper(0, dX, null);
|
||||
if (usingAlt) altBaseEqu!.SetInternalStepper(0, dX);
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
while (stepX < x)
|
||||
{
|
||||
MoveInternalStepper(dX);
|
||||
stepCallback?.Invoke(stepX, stepY);
|
||||
}
|
||||
while (stepX < x) MoveInternalStepper(dX);
|
||||
}
|
||||
else if (x < 0)
|
||||
{
|
||||
while (x < stepX)
|
||||
{
|
||||
MoveInternalStepper(-dX);
|
||||
stepCallback?.Invoke(stepX, stepY);
|
||||
}
|
||||
while (x < stepX) MoveInternalStepper(-dX);
|
||||
}
|
||||
}
|
||||
private void MoveInternalStepper(double dX)
|
||||
@ -195,16 +187,37 @@ public class IntegralEquation : Graphable, IIntegrable, IDerivable
|
||||
// Inefficient for successive calls.
|
||||
public double IntegralAtPoint(double x)
|
||||
{
|
||||
EquationDelegate equ = baseEqu.GetDelegate();
|
||||
if (x > 0)
|
||||
{
|
||||
double start = Math.Min(0, x), end = Math.Max(0, x);
|
||||
const double step = 1e-3;
|
||||
double sum = 0;
|
||||
|
||||
double start = Math.Min(0, x), end = Math.Max(0, x);
|
||||
const double step = 1e-3;
|
||||
double sum = 0;
|
||||
SetInternalStepper(start, step);
|
||||
for (double t = start; t <= end; t += step)
|
||||
{
|
||||
MoveInternalStepper(step);
|
||||
sum += stepY * step;
|
||||
}
|
||||
|
||||
for (double t = start; t <= end; t += step) sum += equ(t) * step;
|
||||
if (x < 0) sum = -sum;
|
||||
return sum;
|
||||
}
|
||||
else if (x < 0)
|
||||
{
|
||||
double start = Math.Max(0, x), end = Math.Min(0, x);
|
||||
const double step = 1e-3;
|
||||
double sum = 0;
|
||||
|
||||
return sum;
|
||||
SetInternalStepper(start, step);
|
||||
for (double t = start; t >= end; t -= step)
|
||||
{
|
||||
MoveInternalStepper(-step);
|
||||
sum -= stepY * step;
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public override bool ShouldSelectGraphable(in GraphForm graph, Float2 graphMousePos, double factor)
|
||||
|
||||
@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<History>True|2024-03-13T14:31:43.4569441Z;False|2024-03-13T10:30:01.4347009-04:00;False|2024-03-13T10:27:31.9554551-04:00;</History>
|
||||
<History>True|2024-03-20T12:39:01.6402921Z;True|2024-03-13T10:31:43.4569441-04:00;False|2024-03-13T10:30:01.4347009-04:00;False|2024-03-13T10:27:31.9554551-04:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@ -5,6 +5,7 @@ This is a graphing calculator I made initially for a Calculus project in a day o
|
||||
Currently, it doesn't have a whole lot of features, but I'll be adding more in the future. Here's currently what it can do:
|
||||
- Graph an equation (duh).
|
||||
- There are currently some rendering issues with asymptotes which will be focused on at some point.
|
||||
- Integrate and derive equations.
|
||||
- Graph a slope field of a `dy/dx =` style equation.
|
||||
- View a tangent line of an equation.
|
||||
- Display a vertical bar graph.
|
||||
@ -74,7 +75,7 @@ An equation requires a delegate such as the one you see. Alternatively, you can
|
||||
graph.Graph(new Equation(x => Math.Pow(2, x))
|
||||
{
|
||||
Color = Color.Green,
|
||||
Name = "2^x"
|
||||
Name = "Exponential Base 2"
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@ -21,14 +21,10 @@ internal static class Program
|
||||
TangentLine tl = new(2, 2, equ);
|
||||
graph.Graph(equ, sf, tl);
|
||||
|
||||
// You can preload graphs in by going Misc > Preload Cache.
|
||||
// Keep in mind this uses more memory than usual and can take
|
||||
// some time.
|
||||
|
||||
// Integrating equations is now much smoother and less intensive.
|
||||
// Try it out!
|
||||
|
||||
// You can click and drag on an equation to select specific points.
|
||||
// Now, when integrating equations, the result is much less jagged
|
||||
// and much faster. Try it out! You can also select points along
|
||||
// equations and such as well. Click on an equation to see for
|
||||
// yourself!
|
||||
|
||||
Application.Run(graph);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user