From a8c51940a32f78f11879270974741b43b1438129 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Thu, 23 Jul 2020 20:50:59 -0700 Subject: Added simple c++/cli wrapper --- rawaccel.sln | 20 +++++++ wrapper/wrapper.cpp | 14 +++++ wrapper/wrapper.hpp | 47 +++++++++++++++ wrapper/wrapper.vcxproj | 126 ++++++++++++++++++++++++++++++++++++++++ wrapper/wrapper.vcxproj.filters | 27 +++++++++ 5 files changed, 234 insertions(+) create mode 100644 wrapper/wrapper.cpp create mode 100644 wrapper/wrapper.hpp create mode 100644 wrapper/wrapper.vcxproj create mode 100644 wrapper/wrapper.vcxproj.filters diff --git a/rawaccel.sln b/rawaccel.sln index 5be7e63..fef1755 100644 --- a/rawaccel.sln +++ b/rawaccel.sln @@ -15,6 +15,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common-install", "common-in EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uninstaller", "uninstaller\uninstaller.vcxproj", "{A4097FF6-A6F0-44E8-B8D0-538D0FB75936}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrapper", "wrapper\wrapper.vcxproj", "{28A3656F-A1DE-405C-B547-191C32EC555F}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution common-install\common-install.vcxitems*{058d66c6-d88b-4fdb-b0e4-0a6fe7483b95}*SharedItemsImports = 9 @@ -26,26 +28,44 @@ Global EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.ActiveCfg = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.Build.0 = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.Deploy.0 = Debug|x64 + {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x86.ActiveCfg = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x64.ActiveCfg = Release|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x64.Build.0 = Release|x64 + {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x86.ActiveCfg = Release|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x64.ActiveCfg = Debug|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x64.Build.0 = Debug|x64 + {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x86.ActiveCfg = Debug|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x64.ActiveCfg = Release|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x64.Build.0 = Release|x64 + {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x86.ActiveCfg = Release|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x64.ActiveCfg = Debug|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x64.Build.0 = Debug|x64 + {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x86.ActiveCfg = Debug|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x64.ActiveCfg = Release|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x64.Build.0 = Release|x64 + {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x86.ActiveCfg = Release|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x64.ActiveCfg = Debug|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x64.Build.0 = Debug|x64 + {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x86.ActiveCfg = Debug|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x64.ActiveCfg = Release|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x64.Build.0 = Release|x64 + {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x86.ActiveCfg = Release|x64 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x64.ActiveCfg = Debug|x64 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x64.Build.0 = Debug|x64 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x86.ActiveCfg = Debug|Win32 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x86.Build.0 = Debug|Win32 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x64.ActiveCfg = Release|x64 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x64.Build.0 = Release|x64 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x86.ActiveCfg = Release|Win32 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/wrapper/wrapper.cpp b/wrapper/wrapper.cpp new file mode 100644 index 0000000..df3f796 --- /dev/null +++ b/wrapper/wrapper.cpp @@ -0,0 +1,14 @@ +#pragma once + +#include "..\common\rawaccel.hpp"; +#include "wrapper.hpp"; +using namespace rawaccel; +using namespace System; + +Tuple^ ManagedAccel::Accelerate(int x, int y, double time, double mode) +{ + vec2d input_vec2d = {x, y}; + vec2d output = (*accel_instance)(input_vec2d, (accel_function::milliseconds)time, (rawaccel::mode)mode); + + return gcnew Tuple(output.x, output.y); +} \ No newline at end of file diff --git a/wrapper/wrapper.hpp b/wrapper/wrapper.hpp new file mode 100644 index 0000000..eaa8489 --- /dev/null +++ b/wrapper/wrapper.hpp @@ -0,0 +1,47 @@ +#pragma once + +#include "..\common\rawaccel.hpp"; +#include "..\common\rawaccel-userspace.hpp"; +#include +using namespace rawaccel; +using namespace System; + +public ref class ManagedAccel +{ +protected: + accel_function* accel_instance; +public: + ManagedAccel(accel_function* accel) + : accel_instance(accel) + { + } + + ManagedAccel(double mode, double offset, double accel, double lim_exp, double midpoint) + { + accel_function::args_t args{}; + + accel_instance = new accel_function(args); + } + + virtual ~ManagedAccel() + { + if (accel_instance != nullptr) + { + delete accel_instance; + } + } + !ManagedAccel() + { + if (accel_instance != nullptr) + { + delete accel_instance; + } + } + + accel_function* GetInstance() + { + return accel_instance; + } + + Tuple^ Accelerate(int x, int y, double time, double mode); +}; \ No newline at end of file diff --git a/wrapper/wrapper.vcxproj b/wrapper/wrapper.vcxproj new file mode 100644 index 0000000..25f878c --- /dev/null +++ b/wrapper/wrapper.vcxproj @@ -0,0 +1,126 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {28A3656F-A1DE-405C-B547-191C32EC555F} + v4.7.2 + ManagedCProj + wrapper + 10.0 + + + + DynamicLibrary + true + v142 + true + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + true + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + Level3 + _DEBUG;%(PreprocessorDefinitions) + stdcpplatest + + + + + + + + Level3 + WIN32;_DEBUG;%(PreprocessorDefinitions) + stdcpplatest + + + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + stdcpplatest + + + + + + + + Level3 + NDEBUG;%(PreprocessorDefinitions) + stdcpplatest + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wrapper/wrapper.vcxproj.filters b/wrapper/wrapper.vcxproj.filters new file mode 100644 index 0000000..22d967d --- /dev/null +++ b/wrapper/wrapper.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + \ No newline at end of file -- cgit v1.2.3 From 02f5d86a891edb2f49851b400b0d2b2f8b4e4f98 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Fri, 24 Jul 2020 11:15:04 -0700 Subject: Add a basic windows forms grapher --- grapher/App.config | 6 ++ grapher/Form1.Designer.cs | 73 +++++++++++++++++++ grapher/Form1.cs | 57 +++++++++++++++ grapher/Form1.resx | 120 +++++++++++++++++++++++++++++++ grapher/Program.cs | 22 ++++++ grapher/Properties/AssemblyInfo.cs | 36 ++++++++++ grapher/Properties/Resources.Designer.cs | 71 ++++++++++++++++++ grapher/Properties/Resources.resx | 117 ++++++++++++++++++++++++++++++ grapher/Properties/Settings.Designer.cs | 30 ++++++++ grapher/Properties/Settings.settings | 7 ++ grapher/grapher.csproj | 90 +++++++++++++++++++++++ rawaccel.sln | 26 +++++++ wrapper/wrapper.hpp | 5 ++ wrapper/wrapper.vcxproj | 8 +-- 14 files changed, 664 insertions(+), 4 deletions(-) create mode 100644 grapher/App.config create mode 100644 grapher/Form1.Designer.cs create mode 100644 grapher/Form1.cs create mode 100644 grapher/Form1.resx create mode 100644 grapher/Program.cs create mode 100644 grapher/Properties/AssemblyInfo.cs create mode 100644 grapher/Properties/Resources.Designer.cs create mode 100644 grapher/Properties/Resources.resx create mode 100644 grapher/Properties/Settings.Designer.cs create mode 100644 grapher/Properties/Settings.settings create mode 100644 grapher/grapher.csproj diff --git a/grapher/App.config b/grapher/App.config new file mode 100644 index 0000000..56efbc7 --- /dev/null +++ b/grapher/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs new file mode 100644 index 0000000..8610ef4 --- /dev/null +++ b/grapher/Form1.Designer.cs @@ -0,0 +1,73 @@ +namespace grapher +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); + System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); + System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); + this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); + ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.SuspendLayout(); + // + // chart1 + // + chartArea1.Name = "ChartArea1"; + this.chart1.ChartAreas.Add(chartArea1); + legend1.Name = "Legend1"; + this.chart1.Legends.Add(legend1); + this.chart1.Location = new System.Drawing.Point(0, 0); + this.chart1.Name = "chart1"; + series1.ChartArea = "ChartArea1"; + series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; + series1.Legend = "Legend1"; + series1.Name = "Series1"; + this.chart1.Series.Add(series1); + this.chart1.Size = new System.Drawing.Size(800, 312); + this.chart1.TabIndex = 0; + this.chart1.Text = "chart1"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 310); + this.Controls.Add(this.chart1); + this.Name = "Form1"; + this.Text = "Form1"; + ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + } +} + diff --git a/grapher/Form1.cs b/grapher/Form1.cs new file mode 100644 index 0000000..b51ebe5 --- /dev/null +++ b/grapher/Form1.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + var managedAccel = new ManagedAccel(6, 0, 0.025, 1.01, 0); + var orderedPoints = new SortedDictionary(); + + for (int i = 0; i < 100; i++) + { + for (int j = 0; j <= i; j++) + { + var output = managedAccel.Accelerate(i, j, 1, 6); + + var inMagnitude = Magnitude(i,j); + var outMagnitude = Magnitude(output.Item1, output.Item2); + var ratio = inMagnitude > 0 ? outMagnitude / inMagnitude : 0; + + if (!orderedPoints.ContainsKey(inMagnitude)) + { + orderedPoints.Add(inMagnitude, ratio); + } + } + } + + var series = this.chart1.Series.FirstOrDefault(); + series.Points.Clear(); + + foreach (var point in orderedPoints) + { + series.Points.AddXY(point.Key, point.Value); + } + } + + public static double Magnitude(int x, int y) + { + return Math.Sqrt(x * x + y * y); + } + + public static double Magnitude(double x, double y) + { + return Math.Sqrt(x * x + y * y); + } + } +} diff --git a/grapher/Form1.resx b/grapher/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/grapher/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/grapher/Program.cs b/grapher/Program.cs new file mode 100644 index 0000000..afd45ba --- /dev/null +++ b/grapher/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace grapher +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/grapher/Properties/AssemblyInfo.cs b/grapher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..939f98a --- /dev/null +++ b/grapher/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("grapher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("grapher")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ef67f71f-abf5-4760-b50d-d1b9836df01c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/grapher/Properties/Resources.Designer.cs b/grapher/Properties/Resources.Designer.cs new file mode 100644 index 0000000..fd16e6f --- /dev/null +++ b/grapher/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace grapher.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("grapher.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/grapher/Properties/Resources.resx b/grapher/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/grapher/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/grapher/Properties/Settings.Designer.cs b/grapher/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d305209 --- /dev/null +++ b/grapher/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace grapher.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/grapher/Properties/Settings.settings b/grapher/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/grapher/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/grapher/grapher.csproj b/grapher/grapher.csproj new file mode 100644 index 0000000..f67ced1 --- /dev/null +++ b/grapher/grapher.csproj @@ -0,0 +1,90 @@ + + + + + Debug + AnyCPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C} + WinExe + grapher + grapher + v4.7.2 + 512 + true + true + + + x64 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x64 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {28a3656f-a1de-405c-b547-191c32ec555f} + wrapper + + + + \ No newline at end of file diff --git a/rawaccel.sln b/rawaccel.sln index fef1755..2235818 100644 --- a/rawaccel.sln +++ b/rawaccel.sln @@ -17,6 +17,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "uninstaller", "uninstaller\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrapper", "wrapper\wrapper.vcxproj", "{28A3656F-A1DE-405C-B547-191C32EC555F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "grapher", "grapher\grapher.csproj", "{EF67F71F-ABF5-4760-B50D-D1B9836DF01C}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution common-install\common-install.vcxitems*{058d66c6-d88b-4fdb-b0e4-0a6fe7483b95}*SharedItemsImports = 9 @@ -27,45 +29,69 @@ Global common\common.vcxitems*{ab7b3759-b85f-4067-8935-fb4539b41869}*SharedItemsImports = 4 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|Any CPU.ActiveCfg = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.ActiveCfg = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.Build.0 = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x64.Deploy.0 = Debug|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Debug|x86.ActiveCfg = Debug|x64 + {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|Any CPU.ActiveCfg = Release|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x64.ActiveCfg = Release|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x64.Build.0 = Release|x64 {60D6C942-AC20-4C05-A2BE-54B5C966534D}.Release|x86.ActiveCfg = Release|x64 + {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|Any CPU.ActiveCfg = Debug|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x64.ActiveCfg = Debug|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x64.Build.0 = Debug|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Debug|x86.ActiveCfg = Debug|x64 + {896950D1-520A-420A-B6B1-73014B92A68C}.Release|Any CPU.ActiveCfg = Release|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x64.ActiveCfg = Release|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x64.Build.0 = Release|x64 {896950D1-520A-420A-B6B1-73014B92A68C}.Release|x86.ActiveCfg = Release|x64 + {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|Any CPU.ActiveCfg = Debug|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x64.ActiveCfg = Debug|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x64.Build.0 = Debug|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Debug|x86.ActiveCfg = Debug|x64 + {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|Any CPU.ActiveCfg = Release|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x64.ActiveCfg = Release|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x64.Build.0 = Release|x64 {AB7B3759-B85F-4067-8935-FB4539B41869}.Release|x86.ActiveCfg = Release|x64 + {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|Any CPU.ActiveCfg = Debug|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x64.ActiveCfg = Debug|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x64.Build.0 = Debug|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Debug|x86.ActiveCfg = Debug|x64 + {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|Any CPU.ActiveCfg = Release|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x64.ActiveCfg = Release|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x64.Build.0 = Release|x64 {A4097FF6-A6F0-44E8-B8D0-538D0FB75936}.Release|x86.ActiveCfg = Release|x64 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|Any CPU.ActiveCfg = Debug|Win32 {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x64.ActiveCfg = Debug|x64 {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x64.Build.0 = Debug|x64 {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x86.ActiveCfg = Debug|Win32 {28A3656F-A1DE-405C-B547-191C32EC555F}.Debug|x86.Build.0 = Debug|Win32 + {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|Any CPU.ActiveCfg = Release|Win32 {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x64.ActiveCfg = Release|x64 {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x64.Build.0 = Release|x64 {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x86.ActiveCfg = Release|Win32 {28A3656F-A1DE-405C-B547-191C32EC555F}.Release|x86.Build.0 = Release|Win32 + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Debug|x64.ActiveCfg = Debug|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Debug|x64.Build.0 = Debug|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Debug|x86.ActiveCfg = Debug|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Debug|x86.Build.0 = Debug|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Release|Any CPU.Build.0 = Release|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Release|x64.ActiveCfg = Release|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Release|x64.Build.0 = Release|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Release|x86.ActiveCfg = Release|Any CPU + {EF67F71F-ABF5-4760-B50D-D1B9836DF01C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/wrapper/wrapper.hpp b/wrapper/wrapper.hpp index eaa8489..24bcadb 100644 --- a/wrapper/wrapper.hpp +++ b/wrapper/wrapper.hpp @@ -19,6 +19,11 @@ public: ManagedAccel(double mode, double offset, double accel, double lim_exp, double midpoint) { accel_function::args_t args{}; + args.accel = accel; + args.lim_exp = lim_exp; + args.midpoint = midpoint; + args.accel_mode = (rawaccel::mode)mode; + args.offset = offset; accel_instance = new accel_function(args); } diff --git a/wrapper/wrapper.vcxproj b/wrapper/wrapper.vcxproj index 25f878c..d27266d 100644 --- a/wrapper/wrapper.vcxproj +++ b/wrapper/wrapper.vcxproj @@ -78,7 +78,7 @@ Level3 _DEBUG;%(PreprocessorDefinitions) - stdcpplatest + stdcpp17 @@ -88,7 +88,7 @@ Level3 WIN32;_DEBUG;%(PreprocessorDefinitions) - stdcpplatest + stdcpp17 @@ -98,7 +98,7 @@ Level3 WIN32;NDEBUG;%(PreprocessorDefinitions) - stdcpplatest + stdcpp17 @@ -108,7 +108,7 @@ Level3 NDEBUG;%(PreprocessorDefinitions) - stdcpplatest + stdcpp17 -- cgit v1.2.3 From eeb1287bb2ed3a634bf9f4ac713779dcfea229b2 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Fri, 24 Jul 2020 17:40:48 -0700 Subject: Add correct names and labels --- grapher/Form1.Designer.cs | 41 ++++++++++++++++++++++------------------- grapher/Form1.cs | 15 +++++++++++---- grapher/Program.cs | 2 +- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/grapher/Form1.Designer.cs b/grapher/Form1.Designer.cs index 8610ef4..b39c887 100644 --- a/grapher/Form1.Designer.cs +++ b/grapher/Form1.Designer.cs @@ -1,6 +1,6 @@ namespace grapher { - partial class Form1 + partial class RawAcceleration { /// /// Required designer variable. @@ -31,43 +31,46 @@ System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend(); System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series(); - this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart(); - ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit(); + this.AccelerationChart = new System.Windows.Forms.DataVisualization.Charting.Chart(); + ((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).BeginInit(); this.SuspendLayout(); // - // chart1 + // AccelerationChart // + chartArea1.AxisX.Title = "Speed (counts/ms)"; + chartArea1.AxisY.Title = "Sensitivity (magnitude ratio)"; chartArea1.Name = "ChartArea1"; - this.chart1.ChartAreas.Add(chartArea1); + this.AccelerationChart.ChartAreas.Add(chartArea1); legend1.Name = "Legend1"; - this.chart1.Legends.Add(legend1); - this.chart1.Location = new System.Drawing.Point(0, 0); - this.chart1.Name = "chart1"; + this.AccelerationChart.Legends.Add(legend1); + this.AccelerationChart.Location = new System.Drawing.Point(0, 0); + this.AccelerationChart.Name = "AccelerationChart"; series1.ChartArea = "ChartArea1"; series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; series1.Legend = "Legend1"; - series1.Name = "Series1"; - this.chart1.Series.Add(series1); - this.chart1.Size = new System.Drawing.Size(800, 312); - this.chart1.TabIndex = 0; - this.chart1.Text = "chart1"; + series1.Name = "Accelerated Sensitivity"; + this.AccelerationChart.Series.Add(series1); + this.AccelerationChart.Size = new System.Drawing.Size(800, 312); + this.AccelerationChart.TabIndex = 0; + this.AccelerationChart.Text = "chart1"; // - // Form1 + // RawAcceleration // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 310); - this.Controls.Add(this.chart1); - this.Name = "Form1"; - this.Text = "Form1"; - ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit(); + this.Controls.Add(this.AccelerationChart); + this.Name = "RawAcceleration"; + this.Text = "Raw Acceleration Graph"; + this.Load += new System.EventHandler(this.Form1_Load); + ((System.ComponentModel.ISupportInitialize)(this.AccelerationChart)).EndInit(); this.ResumeLayout(false); } #endregion - private System.Windows.Forms.DataVisualization.Charting.Chart chart1; + private System.Windows.Forms.DataVisualization.Charting.Chart AccelerationChart; } } diff --git a/grapher/Form1.cs b/grapher/Form1.cs index b51ebe5..1915b01 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -10,12 +10,12 @@ using System.Windows.Forms; namespace grapher { - public partial class Form1 : Form + public partial class RawAcceleration : Form { - public Form1() + public RawAcceleration() { InitializeComponent(); - var managedAccel = new ManagedAccel(6, 0, 0.025, 1.01, 0); + var managedAccel = new ManagedAccel(6, 0, 1, 0.025, 0); var orderedPoints = new SortedDictionary(); for (int i = 0; i < 100; i++) @@ -35,13 +35,15 @@ namespace grapher } } - var series = this.chart1.Series.FirstOrDefault(); + var series = this.AccelerationChart.Series.FirstOrDefault(); series.Points.Clear(); foreach (var point in orderedPoints) { series.Points.AddXY(point.Key, point.Value); } + + this.AccelerationChart.ChartAreas[0].AxisX.RoundAxisValues(); } public static double Magnitude(int x, int y) @@ -53,5 +55,10 @@ namespace grapher { return Math.Sqrt(x * x + y * y); } + + private void Form1_Load(object sender, EventArgs e) + { + + } } } diff --git a/grapher/Program.cs b/grapher/Program.cs index afd45ba..b36ece3 100644 --- a/grapher/Program.cs +++ b/grapher/Program.cs @@ -16,7 +16,7 @@ namespace grapher { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new Form1()); + Application.Run(new RawAcceleration()); } } } -- cgit v1.2.3