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>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<RootNamespace>Graphing</RootNamespace>
|
||||
<AssemblyName>ThatOneNerd.Graphing</AssemblyName>
|
||||
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
|
||||
|
||||
@ -20,4 +20,9 @@
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Forms\ViewCacheForm.resx">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -1,4 +1,6 @@
|
||||
namespace Graphing;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing;
|
||||
|
||||
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
|
||||
{
|
||||
@ -33,7 +35,7 @@
|
||||
// PieChart
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(13F, 32F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
Name = "PieChart";
|
||||
Size = new Size(500, 500);
|
||||
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;
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
namespace Graphing.Forms;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Graphing.Forms;
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
using Graphing.Graphables;
|
||||
using Graphing.Parts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Windows.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
|
||||
{
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
namespace Graphing.Forms;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Graphing.Forms;
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
using Graphing.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Graphing.Forms;
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using Graphing.Forms;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing;
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
using Graphing.Forms;
|
||||
using Graphing.Parts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Graphing.Graphables;
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using Graphing.Forms;
|
||||
using Graphing.Parts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Graphing.Graphables;
|
||||
|
||||
@ -22,15 +24,17 @@ public class Equation : Graphable
|
||||
public override IEnumerable<IGraphPart> GetItemsToRender(in GraphForm graph)
|
||||
{
|
||||
const int step = 10;
|
||||
|
||||
double epsilon = Math.Abs(graph.ScreenSpaceToGraphSpace(new Int2(0, 0)).x
|
||||
- graph.ScreenSpaceToGraphSpace(new Int2(step / 2, 0)).x) / 5;
|
||||
epsilon *= graph.DpiFloat / 192;
|
||||
|
||||
List<IGraphPart> lines = [];
|
||||
|
||||
double previousX = graph.MinVisibleGraph.x;
|
||||
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 currentY = GetFromCache(currentX, epsilon);
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using Graphing.Forms;
|
||||
using Graphing.Parts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Graphing.Graphables;
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using Graphing.Forms;
|
||||
using Graphing.Parts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Graphing.Graphables;
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Graphing.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing;
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace Graphing;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing;
|
||||
|
||||
public record struct Int2
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Graphing.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing.Parts;
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Graphing.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing.Parts;
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Graphing.Forms;
|
||||
using System.Drawing;
|
||||
|
||||
namespace Graphing.Parts;
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
using Graphing.Forms;
|
||||
using Graphing.Graphables;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Graphing.Testing;
|
||||
|
||||
@ -14,10 +16,10 @@ internal static class Program
|
||||
|
||||
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));
|
||||
TangentLine tl = new(2, 2, possibleA);
|
||||
graph.Graph(possibleA, sf, tl);
|
||||
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
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<RootNamespace>Graphing.Testing</RootNamespace>
|
||||
<AssemblyName>ThatOneNerd.Graphing.Testing</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user