Fixed sampling not scaling with DPI. Also disabled implicit usings which is most of this commit.
This commit is contained in:
parent
c30ced7578
commit
762a5f5a32
@ -5,7 +5,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<RootNamespace>Graphing</RootNamespace>
|
<RootNamespace>Graphing</RootNamespace>
|
||||||
<AssemblyName>ThatOneNerd.Graphing</AssemblyName>
|
<AssemblyName>ThatOneNerd.Graphing</AssemblyName>
|
||||||
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
|
||||||
|
|||||||
@ -20,4 +20,9 @@
|
|||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Forms\ViewCacheForm.resx">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,4 +1,6 @@
|
|||||||
namespace Graphing;
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Graphing;
|
||||||
|
|
||||||
public record struct Float2
|
public record struct Float2
|
||||||
{
|
{
|
||||||
|
|||||||
6
Base/Forms/Controls/PieChart.Designer.cs
generated
6
Base/Forms/Controls/PieChart.Designer.cs
generated
@ -1,4 +1,6 @@
|
|||||||
namespace Graphing.Forms.Controls
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Graphing.Forms.Controls
|
||||||
{
|
{
|
||||||
partial class PieChart
|
partial class PieChart
|
||||||
{
|
{
|
||||||
@ -33,7 +35,7 @@
|
|||||||
// PieChart
|
// PieChart
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
Name = "PieChart";
|
Name = "PieChart";
|
||||||
Size = new Size(500, 500);
|
Size = new Size(500, 500);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
using System.Drawing.Drawing2D;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Graphing.Forms.Controls;
|
namespace Graphing.Forms.Controls;
|
||||||
|
|
||||||
|
|||||||
5
Base/Forms/GraphColorPickerForm.Designer.cs
generated
5
Base/Forms/GraphColorPickerForm.Designer.cs
generated
@ -1,4 +1,7 @@
|
|||||||
namespace Graphing.Forms
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Graphing.Forms
|
||||||
{
|
{
|
||||||
partial class GraphColorPickerForm
|
partial class GraphColorPickerForm
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
namespace Graphing.Forms;
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Graphing.Forms;
|
||||||
|
|
||||||
public partial class GraphColorPickerForm : Form
|
public partial class GraphColorPickerForm : Form
|
||||||
{
|
{
|
||||||
|
|||||||
5
Base/Forms/GraphForm.Designer.cs
generated
5
Base/Forms/GraphForm.Designer.cs
generated
@ -1,4 +1,7 @@
|
|||||||
namespace Graphing.Forms
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Graphing.Forms
|
||||||
{
|
{
|
||||||
partial class GraphForm
|
partial class GraphForm
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
using Graphing.Graphables;
|
using Graphing.Graphables;
|
||||||
using Graphing.Parts;
|
using Graphing.Parts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Graphing.Forms;
|
namespace Graphing.Forms;
|
||||||
|
|
||||||
|
|||||||
5
Base/Forms/SetZoomForm.Designer.cs
generated
5
Base/Forms/SetZoomForm.Designer.cs
generated
@ -1,4 +1,7 @@
|
|||||||
namespace Graphing.Forms
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Graphing.Forms
|
||||||
{
|
{
|
||||||
partial class SetZoomForm
|
partial class SetZoomForm
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
namespace Graphing.Forms;
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Graphing.Forms;
|
||||||
|
|
||||||
public partial class SetZoomForm : Form
|
public partial class SetZoomForm : Form
|
||||||
{
|
{
|
||||||
|
|||||||
5
Base/Forms/ViewCacheForm.Designer.cs
generated
5
Base/Forms/ViewCacheForm.Designer.cs
generated
@ -1,4 +1,7 @@
|
|||||||
namespace Graphing.Forms
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Graphing.Forms
|
||||||
{
|
{
|
||||||
partial class ViewCacheForm
|
partial class ViewCacheForm
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
using Graphing.Extensions;
|
using Graphing.Extensions;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Graphing.Forms;
|
namespace Graphing.Forms;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Graphing;
|
namespace Graphing;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
using Graphing.Parts;
|
using Graphing.Parts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Graphing.Graphables;
|
namespace Graphing.Graphables;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
using Graphing.Parts;
|
using Graphing.Parts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Graphing.Graphables;
|
namespace Graphing.Graphables;
|
||||||
|
|
||||||
@ -22,15 +24,17 @@ public class Equation : Graphable
|
|||||||
public override IEnumerable<IGraphPart> GetItemsToRender(in GraphForm graph)
|
public override IEnumerable<IGraphPart> GetItemsToRender(in GraphForm graph)
|
||||||
{
|
{
|
||||||
const int step = 10;
|
const int step = 10;
|
||||||
|
|
||||||
double epsilon = Math.Abs(graph.ScreenSpaceToGraphSpace(new Int2(0, 0)).x
|
double epsilon = Math.Abs(graph.ScreenSpaceToGraphSpace(new Int2(0, 0)).x
|
||||||
- graph.ScreenSpaceToGraphSpace(new Int2(step / 2, 0)).x) / 5;
|
- graph.ScreenSpaceToGraphSpace(new Int2(step / 2, 0)).x) / 5;
|
||||||
|
epsilon *= graph.DpiFloat / 192;
|
||||||
|
|
||||||
List<IGraphPart> lines = [];
|
List<IGraphPart> lines = [];
|
||||||
|
|
||||||
double previousX = graph.MinVisibleGraph.x;
|
double previousX = graph.MinVisibleGraph.x;
|
||||||
double previousY = GetFromCache(previousX, epsilon);
|
double previousY = GetFromCache(previousX, epsilon);
|
||||||
|
|
||||||
for (int i = 1; i < graph.ClientRectangle.Width; i += step)
|
for (int i = 0; i < graph.ClientRectangle.Width + step; i += step)
|
||||||
{
|
{
|
||||||
double currentX = graph.ScreenSpaceToGraphSpace(new Int2(i, 0)).x;
|
double currentX = graph.ScreenSpaceToGraphSpace(new Int2(i, 0)).x;
|
||||||
double currentY = GetFromCache(currentX, epsilon);
|
double currentY = GetFromCache(currentX, epsilon);
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
using Graphing.Parts;
|
using Graphing.Parts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Graphing.Graphables;
|
namespace Graphing.Graphables;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
using Graphing.Parts;
|
using Graphing.Parts;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Graphing.Graphables;
|
namespace Graphing.Graphables;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Graphing;
|
namespace Graphing;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
namespace Graphing;
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace Graphing;
|
||||||
|
|
||||||
public record struct Int2
|
public record struct Int2
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Graphing.Parts;
|
namespace Graphing.Parts;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Graphing.Parts;
|
namespace Graphing.Parts;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace Graphing.Parts;
|
namespace Graphing.Parts;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
using Graphing.Forms;
|
using Graphing.Forms;
|
||||||
using Graphing.Graphables;
|
using Graphing.Graphables;
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Graphing.Testing;
|
namespace Graphing.Testing;
|
||||||
|
|
||||||
@ -14,10 +16,10 @@ internal static class Program
|
|||||||
|
|
||||||
GraphForm graph = new("One Of The Graphing Calculators Of All Time");
|
GraphForm graph = new("One Of The Graphing Calculators Of All Time");
|
||||||
|
|
||||||
Equation possibleA = new(Math.Sin);
|
Equation equ = new(x => Math.Sin(x));
|
||||||
SlopeField sf = new(2, (x, y) => Math.Cos(x));
|
SlopeField sf = new(2, (x, y) => Math.Cos(x));
|
||||||
TangentLine tl = new(2, 2, possibleA);
|
TangentLine tl = new(2, 2, equ);
|
||||||
graph.Graph(possibleA, sf, tl);
|
graph.Graph(equ, sf, tl);
|
||||||
|
|
||||||
// You can preload graphs in by going Misc > Preload Cache.
|
// You can preload graphs in by going Misc > Preload Cache.
|
||||||
// Keep in mind this uses more memory than usual and can take
|
// Keep in mind this uses more memory than usual and can take
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>disable</ImplicitUsings>
|
||||||
<RootNamespace>Graphing.Testing</RootNamespace>
|
<RootNamespace>Graphing.Testing</RootNamespace>
|
||||||
<AssemblyName>ThatOneNerd.Graphing.Testing</AssemblyName>
|
<AssemblyName>ThatOneNerd.Graphing.Testing</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user