├── .gitattributes ├── .gitignore ├── LICENSE ├── Mouse_Orbit ├── App.config ├── BatuGL.cs ├── MainForm.Designer.cs ├── MainForm.cs ├── MainForm.resx ├── Mouse_Orbit.csproj ├── Mouse_Orbit.sln ├── Orbiter.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings └── bin │ └── Debug │ ├── Mouse_Orbit.exe.config │ ├── OpenTK.Compatibility.dll │ ├── OpenTK.GLControl.dll │ └── OpenTK.dll ├── README.md └── orbit_features.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.suo 8 | *.user 9 | *.userosscache 10 | *.sln.docstates 11 | 12 | # User-specific files (MonoDevelop/Xamarin Studio) 13 | *.userprefs 14 | 15 | # Build results 16 | #[Dd]ebug/ 17 | [Dd]ebugPublic/ 18 | #[Rr]elease/ 19 | [Rr]eleases/ 20 | x64/ 21 | x86/ 22 | bld/ 23 | #[Bb]in/ 24 | #[Oo]bj/ 25 | [Ll]og/ 26 | 27 | # Visual Studio 2015/2017 cache/options directory 28 | .vs/ 29 | # Uncomment if you have tasks that create the project's static files in wwwroot 30 | #wwwroot/ 31 | 32 | # Visual Studio 2017 auto generated files 33 | Generated\ Files/ 34 | 35 | # MSTest test Results 36 | [Tt]est[Rr]esult*/ 37 | [Bb]uild[Ll]og.* 38 | 39 | # NUNIT 40 | *.VisualState.xml 41 | TestResult.xml 42 | 43 | # Build Results of an ATL Project 44 | [Dd]ebugPS/ 45 | [Rr]eleasePS/ 46 | dlldata.c 47 | 48 | # Benchmark Results 49 | BenchmarkDotNet.Artifacts/ 50 | 51 | # .NET Core 52 | project.lock.json 53 | project.fragment.lock.json 54 | artifacts/ 55 | **/Properties/launchSettings.json 56 | 57 | # StyleCop 58 | StyleCopReport.xml 59 | 60 | # Files built by Visual Studio 61 | *_i.c 62 | *_p.c 63 | *_i.h 64 | *.ilk 65 | *.meta 66 | *.obj 67 | *.pch 68 | *.pdb 69 | *.pgc 70 | *.pgd 71 | *.rsp 72 | *.sbr 73 | *.tlb 74 | *.tli 75 | *.tlh 76 | *.tmp 77 | *.tmp_proj 78 | *.log 79 | *.vspscc 80 | *.vssscc 81 | .builds 82 | *.pidb 83 | *.svclog 84 | *.scc 85 | 86 | # Chutzpah Test files 87 | _Chutzpah* 88 | 89 | # Visual C++ cache files 90 | ipch/ 91 | *.aps 92 | *.ncb 93 | *.opendb 94 | *.opensdf 95 | *.sdf 96 | *.cachefile 97 | *.VC.db 98 | *.VC.VC.opendb 99 | 100 | # Visual Studio profiler 101 | *.psess 102 | *.vsp 103 | *.vspx 104 | *.sap 105 | 106 | # Visual Studio Trace Files 107 | *.e2e 108 | 109 | # TFS 2012 Local Workspace 110 | $tf/ 111 | 112 | # Guidance Automation Toolkit 113 | *.gpState 114 | 115 | # ReSharper is a .NET coding add-in 116 | _ReSharper*/ 117 | *.[Rr]e[Ss]harper 118 | *.DotSettings.user 119 | 120 | # JustCode is a .NET coding add-in 121 | .JustCode 122 | 123 | # TeamCity is a build add-in 124 | _TeamCity* 125 | 126 | # DotCover is a Code Coverage Tool 127 | *.dotCover 128 | 129 | # AxoCover is a Code Coverage Tool 130 | .axoCover/* 131 | !.axoCover/settings.json 132 | 133 | # Visual Studio code coverage results 134 | *.coverage 135 | *.coveragexml 136 | 137 | # NCrunch 138 | _NCrunch_* 139 | .*crunch*.local.xml 140 | nCrunchTemp_* 141 | 142 | # MightyMoose 143 | *.mm.* 144 | AutoTest.Net/ 145 | 146 | # Web workbench (sass) 147 | .sass-cache/ 148 | 149 | # Installshield output folder 150 | [Ee]xpress/ 151 | 152 | # DocProject is a documentation generator add-in 153 | DocProject/buildhelp/ 154 | DocProject/Help/*.HxT 155 | DocProject/Help/*.HxC 156 | DocProject/Help/*.hhc 157 | DocProject/Help/*.hhk 158 | DocProject/Help/*.hhp 159 | DocProject/Help/Html2 160 | DocProject/Help/html 161 | 162 | # Click-Once directory 163 | publish/ 164 | 165 | # Publish Web Output 166 | *.[Pp]ublish.xml 167 | *.azurePubxml 168 | # Note: Comment the next line if you want to checkin your web deploy settings, 169 | # but database connection strings (with potential passwords) will be unencrypted 170 | *.pubxml 171 | *.publishproj 172 | 173 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 174 | # checkin your Azure Web App publish settings, but sensitive information contained 175 | # in these scripts will be unencrypted 176 | PublishScripts/ 177 | 178 | # NuGet Packages 179 | *.nupkg 180 | # The packages folder can be ignored because of Package Restore 181 | **/[Pp]ackages/* 182 | # except build/, which is used as an MSBuild target. 183 | !**/[Pp]ackages/build/ 184 | # Uncomment if necessary however generally it will be regenerated when needed 185 | #!**/[Pp]ackages/repositories.config 186 | # NuGet v3's project.json files produces more ignorable files 187 | *.nuget.props 188 | *.nuget.targets 189 | 190 | # Microsoft Azure Build Output 191 | csx/ 192 | *.build.csdef 193 | 194 | # Microsoft Azure Emulator 195 | ecf/ 196 | rcf/ 197 | 198 | # Windows Store app package directories and files 199 | AppPackages/ 200 | BundleArtifacts/ 201 | Package.StoreAssociation.xml 202 | _pkginfo.txt 203 | *.appx 204 | 205 | # Visual Studio cache files 206 | # files ending in .cache can be ignored 207 | *.[Cc]ache 208 | # but keep track of directories ending in .cache 209 | !*.[Cc]ache/ 210 | 211 | # Others 212 | ClientBin/ 213 | ~$* 214 | *~ 215 | *.dbmdl 216 | *.dbproj.schemaview 217 | *.jfm 218 | *.pfx 219 | *.publishsettings 220 | orleans.codegen.cs 221 | 222 | # Including strong name files can present a security risk 223 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 224 | #*.snk 225 | 226 | # Since there are multiple workflows, uncomment next line to ignore bower_components 227 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 228 | #bower_components/ 229 | 230 | # RIA/Silverlight projects 231 | Generated_Code/ 232 | 233 | # Backup & report files from converting an old project file 234 | # to a newer Visual Studio version. Backup files are not needed, 235 | # because we have git ;-) 236 | _UpgradeReport_Files/ 237 | Backup*/ 238 | UpgradeLog*.XML 239 | UpgradeLog*.htm 240 | ServiceFabricBackup/ 241 | 242 | # SQL Server files 243 | *.mdf 244 | *.ldf 245 | *.ndf 246 | 247 | # Business Intelligence projects 248 | *.rdl.data 249 | *.bim.layout 250 | *.bim_*.settings 251 | *.rptproj.rsuser 252 | 253 | # Microsoft Fakes 254 | FakesAssemblies/ 255 | 256 | # GhostDoc plugin setting file 257 | *.GhostDoc.xml 258 | 259 | # Node.js Tools for Visual Studio 260 | .ntvs_analysis.dat 261 | node_modules/ 262 | 263 | # Visual Studio 6 build log 264 | *.plg 265 | 266 | # Visual Studio 6 workspace options file 267 | *.opt 268 | 269 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 270 | *.vbw 271 | 272 | # Visual Studio LightSwitch build output 273 | **/*.HTMLClient/GeneratedArtifacts 274 | **/*.DesktopClient/GeneratedArtifacts 275 | **/*.DesktopClient/ModelManifest.xml 276 | **/*.Server/GeneratedArtifacts 277 | **/*.Server/ModelManifest.xml 278 | _Pvt_Extensions 279 | 280 | # Paket dependency manager 281 | .paket/paket.exe 282 | paket-files/ 283 | 284 | # FAKE - F# Make 285 | .fake/ 286 | 287 | # JetBrains Rider 288 | .idea/ 289 | *.sln.iml 290 | 291 | # CodeRush 292 | .cr/ 293 | 294 | # Python Tools for Visual Studio (PTVS) 295 | __pycache__/ 296 | *.pyc 297 | 298 | # Cake - Uncomment if you are using it 299 | # tools/** 300 | # !tools/packages.config 301 | 302 | # Tabs Studio 303 | *.tss 304 | 305 | # Telerik's JustMock configuration file 306 | *.jmconfig 307 | 308 | # BizTalk build output 309 | *.btp.cs 310 | *.btm.cs 311 | *.odx.cs 312 | *.xsd.cs 313 | 314 | # OpenCover UI analysis results 315 | OpenCover/ 316 | 317 | # Azure Stream Analytics local run output 318 | ASALocalRun/ 319 | 320 | # MSBuild Binary and Structured Log 321 | *.binlog 322 | 323 | # NVidia Nsight GPU debugger configuration file 324 | *.nvuser 325 | *.manifest 326 | *.exe 327 | Mouse_Orbit/obj/ 328 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 Ali Batuhan KINDAN 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /Mouse_Orbit/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Mouse_Orbit/BatuGL.cs: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file BatuGL.cs 4 | * @author Ali Batuhan KINDAN 5 | * @date 19.12.2019 6 | * @brief This file contains the methods for opengl graphics features 7 | ****************************************************************************** 8 | */ 9 | 10 | /* 11 | * Mouse Orbit - Quaternion Based Mouse Orbit Algorithm 12 | * Copyright (C) 2017, 2019 Ali Batuhan KINDAN 13 | * 14 | * This program is free software: you can redistribute it and/or modify 15 | * it under the terms of the GNU General Public License as published by 16 | * the Free Software Foundation, either version 3 of the License, or 17 | * (at your option) any later version. 18 | * 19 | * This program is distributed in the hope that it will be useful, 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | * GNU General Public License for more details. 23 | * 24 | * You should have received a copy of the GNU General Public License 25 | * along with this program. If not, see . 26 | */ 27 | 28 | using OpenTK.Graphics.OpenGL; 29 | using System.Drawing; 30 | 31 | namespace Mouse_Orbit 32 | { 33 | public static class BatuGL 34 | { 35 | /** 36 | * @brief This function is using to make initial configuration to 37 | * GL Control element before drawing 38 | * @param refGLControl 39 | * @retval none 40 | */ 41 | public static void Configure(OpenTK.GLControl refGLControl) 42 | { 43 | GL.ClearColor(Color.Black); 44 | refGLControl.VSync = false; 45 | GL.Clear(ClearBufferMask.ColorBufferBit); 46 | GL.Enable(EnableCap.Blend); 47 | GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); 48 | 49 | GL.ClearColor(Color.Gray); 50 | GL.MatrixMode(MatrixMode.Modelview); 51 | GL.LoadIdentity(); 52 | GL.Viewport(refGLControl.Size); 53 | GL.Ortho(-refGLControl.Width / 2, refGLControl.Width / 2, -refGLControl.Height / 2, refGLControl.Height / 2, -20000, 20000); 54 | 55 | GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); 56 | GL.ClearDepth(1.0f); 57 | GL.Enable(EnableCap.DepthTest); 58 | GL.DepthFunc(DepthFunction.Lequal); 59 | 60 | GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); 61 | GL.Enable(EnableCap.LineSmooth); 62 | GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); 63 | GL.Enable(EnableCap.PolygonSmooth); 64 | GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Nicest); 65 | } 66 | 67 | /** 68 | * @brief This function draws a cube around the origin with given size 69 | * @param size 70 | * @retval none 71 | */ 72 | public static void DrawCube(int size) 73 | { 74 | /* draw unit cube then scale it with given size */ 75 | GL.PushMatrix(); 76 | GL.Scale(size, size, size); 77 | 78 | GL.Begin(PrimitiveType.Quads); 79 | GL.Color3(Color.Crimson); 80 | GL.Vertex3(0.5f, 0.5f, -0.5f); 81 | GL.Vertex3(-0.5f, 0.5f, -0.5f); 82 | GL.Vertex3(-0.5f, -0.5f, -0.5f); 83 | GL.Vertex3(0.5f, -0.5f, -0.5f); 84 | GL.End(); 85 | 86 | GL.Begin(PrimitiveType.Quads); 87 | GL.Color3(Color.Yellow); 88 | GL.Vertex3(0.5f, 0.5f, 0.5f); 89 | GL.Vertex3(-0.5f, 0.5f, 0.5f); 90 | GL.Vertex3(-0.5f, -0.5f, 0.5f); 91 | GL.Vertex3(0.5f, -0.5f, 0.5f); 92 | GL.End(); 93 | 94 | GL.Begin(PrimitiveType.Quads); 95 | GL.Color3(Color.DarkOrange); 96 | GL.Vertex3(0.5f, 0.5f, 0.5f); 97 | GL.Vertex3(0.5f, -0.5f, 0.5f); 98 | GL.Vertex3(0.5f, -0.5f, -0.5f); 99 | GL.Vertex3(0.5f, 0.5f, -0.5f); 100 | GL.End(); 101 | 102 | GL.Begin(PrimitiveType.Quads); 103 | GL.Color3(Color.BlueViolet); 104 | GL.Vertex3(-0.5f, 0.5f, 0.5f); 105 | GL.Vertex3(-0.5f, -0.5f, 0.5f); 106 | GL.Vertex3(-0.5f, -0.5f, -0.5f); 107 | GL.Vertex3(-0.5f, 0.5f, -0.5f); 108 | GL.End(); 109 | 110 | GL.Begin(PrimitiveType.Quads); 111 | GL.Color3(Color.Purple); 112 | GL.Vertex3(0.5f, 0.5f, 0.5f); 113 | GL.Vertex3(-0.5f, 0.5f, 0.5f); 114 | GL.Vertex3(-0.5f, 0.5f, -0.5f); 115 | GL.Vertex3(0.5f, 0.5f, -0.5f); 116 | GL.End(); 117 | 118 | GL.Begin(PrimitiveType.Quads); 119 | GL.Color3(Color.LightSeaGreen); 120 | GL.Vertex3(0.5f, -0.5f, 0.5f); 121 | GL.Vertex3(-0.5f, -0.5f, 0.5f); 122 | GL.Vertex3(-0.5f, -0.5f, -0.5f); 123 | GL.Vertex3(0.5f, -0.5f, -0.5f); 124 | GL.End(); 125 | 126 | GL.PopMatrix(); 127 | } 128 | 129 | 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /Mouse_Orbit/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Mouse_Orbit 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.GL_Monitor = new OpenTK.GLControl(); 33 | this.DrawTimer = new System.Windows.Forms.Timer(this.components); 34 | this.SuspendLayout(); 35 | // 36 | // GL_Monitor 37 | // 38 | this.GL_Monitor.BackColor = System.Drawing.Color.Black; 39 | this.GL_Monitor.Dock = System.Windows.Forms.DockStyle.Fill; 40 | this.GL_Monitor.Location = new System.Drawing.Point(0, 0); 41 | this.GL_Monitor.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); 42 | this.GL_Monitor.Name = "GL_Monitor"; 43 | this.GL_Monitor.Size = new System.Drawing.Size(782, 553); 44 | this.GL_Monitor.TabIndex = 0; 45 | this.GL_Monitor.VSync = false; 46 | this.GL_Monitor.Load += new System.EventHandler(this.GL_Monitor_Load); 47 | this.GL_Monitor.Paint += new System.Windows.Forms.PaintEventHandler(this.GL_Monitor_Paint); 48 | // 49 | // DrawTimer 50 | // 51 | this.DrawTimer.Interval = 20; 52 | this.DrawTimer.Tick += new System.EventHandler(this.DrawTimer_Tick); 53 | // 54 | // MainForm 55 | // 56 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); 57 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 58 | this.ClientSize = new System.Drawing.Size(782, 553); 59 | this.Controls.Add(this.GL_Monitor); 60 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 61 | this.Name = "MainForm"; 62 | this.Text = "Mouse Orbit App"; 63 | this.Load += new System.EventHandler(this.MainForm_Load); 64 | this.ResumeLayout(false); 65 | 66 | } 67 | 68 | #endregion 69 | 70 | private OpenTK.GLControl GL_Monitor; 71 | private System.Windows.Forms.Timer DrawTimer; 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /Mouse_Orbit/MainForm.cs: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file MainForm.cs 4 | * @author Ali Batuhan KINDAN 5 | * @date 17.12.2019 6 | * @brief This program performs the quaternion based mouse orbit algorithm. The 7 | * app is the re-make of my older mouse orbit implementation that I made 8 | * in 2017 with an older OpenGL API (Tao Framework). 9 | ****************************************************************************** 10 | */ 11 | 12 | /* 13 | * Mouse Orbit - Quaternion Based Mouse Orbit Algorithm 14 | * Copyright (C) 2017, 2019 Ali Batuhan KINDAN 15 | * 16 | * This program is free software: you can redistribute it and/or modify 17 | * it under the terms of the GNU General Public License as published by 18 | * the Free Software Foundation, either version 3 of the License, or 19 | * (at your option) any later version. 20 | * 21 | * This program is distributed in the hope that it will be useful, 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 | * GNU General Public License for more details. 25 | * 26 | * You should have received a copy of the GNU General Public License 27 | * along with this program. If not, see . 28 | */ 29 | 30 | using System; 31 | using System.Collections.Generic; 32 | using System.ComponentModel; 33 | using System.Data; 34 | using System.Drawing; 35 | using System.Linq; 36 | using System.Text; 37 | using System.Threading.Tasks; 38 | using System.Windows.Forms; 39 | using OpenTK.Graphics.OpenGL; 40 | 41 | namespace Mouse_Orbit 42 | { 43 | public partial class MainForm : Form 44 | { 45 | bool monitorLoaded = false; 46 | Orbiter orb; 47 | 48 | public MainForm() 49 | { 50 | InitializeComponent(); 51 | orb = new Orbiter(); 52 | GL_Monitor.MouseDown += orb.Control_MouseDownEvent; 53 | GL_Monitor.MouseUp += orb.Control_MouseUpEvent; 54 | GL_Monitor.MouseWheel += orb.Control_MouseWheelEvent; 55 | GL_Monitor.KeyPress += orb.Control_KeyPress_Event; 56 | } 57 | 58 | private void GL_Monitor_Load(object sender, EventArgs e) 59 | { 60 | monitorLoaded = true; 61 | GL.ClearColor(Color.Black); 62 | DrawTimer.Enabled = true; 63 | } 64 | 65 | private void MainForm_Load(object sender, EventArgs e) 66 | { 67 | BatuGL.Configure(GL_Monitor); 68 | } 69 | 70 | private void GL_Monitor_Paint(object sender, PaintEventArgs e) 71 | { 72 | if (!monitorLoaded) 73 | return; 74 | 75 | BatuGL.Configure(GL_Monitor); 76 | GL.Translate(orb.PanX, orb.PanY, 0); 77 | GL.Scale(orb.scaleVal, orb.scaleVal, orb.scaleVal); 78 | GL.Rotate(orb.orbitStr.angle, orb.orbitStr.ox, orb.orbitStr.oy, orb.orbitStr.oz); 79 | BatuGL.DrawCube(200); 80 | GL_Monitor.SwapBuffers(); 81 | } 82 | 83 | private void DrawTimer_Tick(object sender, EventArgs e) 84 | { 85 | orb.UpdateOrbiter(MousePosition.X, MousePosition.Y); 86 | GL_Monitor.Invalidate(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Mouse_Orbit/MainForm.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /Mouse_Orbit/Mouse_Orbit.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D1467661-449A-451E-9061-E7CC8C774FB0} 8 | WinExe 9 | Mouse_Orbit 10 | Mouse_Orbit 11 | v4.7.2 12 | 512 13 | true 14 | true 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | False 38 | bin\Debug\OpenTK.dll 39 | 40 | 41 | False 42 | bin\Debug\OpenTK.Compatibility.dll 43 | 44 | 45 | False 46 | bin\Debug\OpenTK.GLControl.dll 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Form 65 | 66 | 67 | MainForm.cs 68 | 69 | 70 | 71 | 72 | MainForm.cs 73 | 74 | 75 | ResXFileCodeGenerator 76 | Resources.Designer.cs 77 | Designer 78 | 79 | 80 | True 81 | Resources.resx 82 | 83 | 84 | SettingsSingleFileGenerator 85 | Settings.Designer.cs 86 | 87 | 88 | True 89 | Settings.settings 90 | True 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Mouse_Orbit/Mouse_Orbit.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29411.108 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mouse_Orbit", "Mouse_Orbit.csproj", "{D1467661-449A-451E-9061-E7CC8C774FB0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {D1467661-449A-451E-9061-E7CC8C774FB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {D1467661-449A-451E-9061-E7CC8C774FB0}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {D1467661-449A-451E-9061-E7CC8C774FB0}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {D1467661-449A-451E-9061-E7CC8C774FB0}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {2C270A8A-6DE5-41A4-A5CF-A94413FD2B86} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Mouse_Orbit/Orbiter.cs: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Orbiter.cs 4 | * @author Ali Batuhan KINDAN 5 | * @date 20.12.2019 6 | * @brief This file contains the classes and methods for handling the Mouse 7 | * Orbit calculation. 8 | ****************************************************************************** 9 | */ 10 | 11 | /* 12 | * Mouse Orbit - Quaternion Based Mouse Orbit Algorithm 13 | * Copyright (C) 2017, 2019 Ali Batuhan KINDAN 14 | * 15 | * This program is free software: you can redistribute it and/or modify 16 | * it under the terms of the GNU General Public License as published by 17 | * the Free Software Foundation, either version 3 of the License, or 18 | * (at your option) any later version. 19 | * 20 | * This program is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | * GNU General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public License 26 | * along with this program. If not, see . 27 | */ 28 | using System; 29 | using System.Windows.Forms; 30 | 31 | namespace Mouse_Orbit 32 | { 33 | 34 | public class Orbiter 35 | { 36 | public float scaleVal = 1.0f; 37 | float maxScale = 10.0f; 38 | public int PanX = 0; 39 | public int PanY = 0; 40 | public Orbit orbitStr; 41 | 42 | const double deg2Rad = Math.PI / 180.0; 43 | const double rad2Deg = 180.0 / Math.PI; 44 | Quaternion qdMouse = new Quaternion(1, 0, 0, 0); 45 | Quaternion qGlobal_E = new Quaternion(1, 0, 0, 0); 46 | Quaternion qGlobal = new Quaternion(1, 0, 0, 0); 47 | Vector3 vdMouse = new Vector3(0, 0, 0); 48 | float ortbitSensitivity = 0.2f; 49 | bool enableOrbit = false; 50 | bool enablePan = false; 51 | int mouseX_Old = 0; 52 | int mouseY_Old = 0; 53 | int difX = 0; 54 | int difY = 0; 55 | 56 | public struct Orbit 57 | { 58 | public float angle, ox, oy, oz; 59 | public void Reset() 60 | { 61 | angle = 0; 62 | ox = 0; 63 | oy = 0; 64 | oz = 0; 65 | } 66 | public Orbit(float angleDeg = 0, float x = 0, float y = 0, float z = 0) 67 | { 68 | angle = angleDeg; 69 | ox = x; 70 | oy = y; 71 | oz = z; 72 | } 73 | } 74 | 75 | private struct Quaternion 76 | { 77 | public float qw, qx, qy, qz; 78 | public void Reset() 79 | { 80 | qw = 1; 81 | qx = 0; 82 | qy = 0; 83 | qz = 0; 84 | } 85 | public Quaternion(float w = 1, float x = 0, float y = 0, float z = 0) 86 | { 87 | qw = w; 88 | qx = x; 89 | qy = y; 90 | qz = z; 91 | } 92 | } 93 | 94 | private struct Vector3 95 | { 96 | public float vx, vy, vz; 97 | public void Reset() 98 | { 99 | vx = 0; 100 | vy = 0; 101 | vz = 0; 102 | } 103 | public Vector3(float x = 0, float y = 0, float z = 0) 104 | { 105 | vx = x; 106 | vy = y; 107 | vz = z; 108 | } 109 | } 110 | 111 | /** 112 | * @brief This function is using to make a rotation quaternion with 113 | * given vector and rotation amount in radians 114 | * @param radTheta 115 | * @param v 116 | * @retval Quaternion 117 | */ 118 | private Quaternion Quat_Make(float radTheta, Vector3 v) 119 | { 120 | Quaternion q = new Quaternion 121 | { 122 | qw = (float)Math.Cos(radTheta / 2.0f), 123 | qx = v.vx * (float)Math.Sin(radTheta / 2.0f), 124 | qy = v.vy * (float)Math.Sin(radTheta / 2.0f), 125 | qz = v.vz * (float)Math.Sin(radTheta / 2.0f) 126 | }; 127 | 128 | return q; 129 | } 130 | 131 | /** 132 | * @brief This function is using to normalize quaternions 133 | * We need to normaize the quaternions before the multiplication 134 | * they must be unit quaternions 135 | * @param qN 136 | * @retval none 137 | */ 138 | private void Quat_Normalize(ref Quaternion qN) 139 | { 140 | /* add very small value to avoid divide by zero error */ 141 | float R = (float)Math.Sqrt(qN.qw * qN.qw + qN.qx * qN.qx + qN.qy * qN.qy + qN.qz * qN.qz) + 0.0000001f; 142 | qN.qw /= R; 143 | qN.qx /= R; 144 | qN.qy /= R; 145 | qN.qz /= R; 146 | } 147 | 148 | /** 149 | * @brief This function is using to multiply quaternions (Hamilton Product) 150 | * @param q1 151 | * @param q2 152 | * @retval Quaternion 153 | */ 154 | private Quaternion Quat_Multiply(Quaternion q1, Quaternion q2) 155 | { 156 | Quaternion q3 = new Quaternion 157 | { 158 | /* Hamilton Product Assemble Routine */ 159 | qw = (q1.qw * q2.qw - q1.qx * q2.qx - q1.qy * q2.qy - q1.qz * q2.qz), 160 | qx = (q1.qw * q2.qx + q1.qx * q2.qw + q1.qy * q2.qz - q1.qz * q2.qy), 161 | qy = (q1.qw * q2.qy - q1.qx * q2.qz + q1.qy * q2.qw + q1.qz * q2.qx), 162 | qz = (q1.qw * q2.qz + q1.qx * q2.qy - q1.qy * q2.qx + q1.qz * q2.qw) 163 | }; 164 | 165 | return q3; 166 | } 167 | 168 | /** 169 | * @brief This function is using to calculate current raotation quaternion from 170 | * mouse coordinates that are updated from Update_Coordinates function. 171 | * @param mouseX 172 | * @param mouseY 173 | * @retval Quaternion 174 | */ 175 | public Orbit Get_Orbit(int mouseDifX, int mouseDifY) 176 | { 177 | if(mouseDifX != 0 || mouseDifY != 0) 178 | { 179 | /* rotate mouse derivative vector 90 degrees and assign to mouse vector 180 | in order to assemble the rotation shaft. to rotate -90 degrees CCW we 181 | need to multiply coordinate values with "-i". if v = x + yi , v' = -i * v 182 | so v' = y - xi which is the rotated vector. This rotation vector calculated 183 | by assuming that we are using Orthographic Projection (GL.Ortho) with Z settings 184 | of Z-Near = negative max value and Z-Far = positive max value. If you change Ortho 185 | config you will need to revert orbit vector by multiplying X and Y part by -1.*/ 186 | vdMouse.vx = mouseDifY * ortbitSensitivity; 187 | vdMouse.vy = -mouseDifX * ortbitSensitivity; 188 | vdMouse.vz = 0; 189 | 190 | float dTheta = -(float)Math.Sqrt(vdMouse.vx * vdMouse.vx + vdMouse.vy * vdMouse.vy); 191 | qdMouse = Quat_Make((float)(dTheta * deg2Rad), vdMouse); 192 | Quat_Normalize(ref qdMouse); /* normalize before rotation */ 193 | qGlobal = Quat_Multiply(qdMouse, qGlobal_E); /* inverse rotation */ 194 | Quat_Normalize(ref qGlobal); /* normalize after rotation */ 195 | qGlobal_E = qGlobal; /* update old value to use it in the next iteration */ 196 | } 197 | 198 | return new Orbit((float)(2 * Math.Acos(qGlobal.qw) * rad2Deg), qGlobal.qx, qGlobal.qy, qGlobal.qz); 199 | } 200 | 201 | /** 202 | * @brief This function resets all features; orientaion, pan and zoom 203 | * So instrad of calling all of them just call this method 204 | * @param none 205 | * @retval none 206 | */ 207 | public void Reset_All() 208 | { 209 | Reset_Orientation(); 210 | Reset_Pan(); 211 | Reset_Scale(); 212 | } 213 | 214 | /** 215 | * @brief This function resets the current orientation to the default 216 | * @param none 217 | * @retval none 218 | */ 219 | public void Reset_Orientation() 220 | { 221 | qdMouse.Reset(); 222 | qGlobal_E.Reset(); 223 | qGlobal.Reset(); 224 | vdMouse.Reset(); 225 | orbitStr.Reset(); 226 | } 227 | 228 | /** 229 | * @brief This function resets the current Pan value to default 230 | * @param none 231 | * @retval none 232 | */ 233 | public void Reset_Pan() 234 | { 235 | PanX = 0; 236 | PanY = 0; 237 | } 238 | 239 | /** 240 | * @brief This function resets the current Scale value to default 241 | * @param none 242 | * @retval none 243 | */ 244 | public void Reset_Scale() 245 | { 246 | scaleVal = 1.0f; 247 | } 248 | 249 | /** 250 | * @brief This function gets the scale limit 251 | * @param maxScale 252 | * @retval none 253 | */ 254 | public float Get_Max_Scale() 255 | { 256 | return maxScale; 257 | } 258 | 259 | /** 260 | * @brief This function sets the scale limit 261 | * @param value 262 | * @retval none 263 | */ 264 | public void Set_Max_Scale(float value) 265 | { 266 | maxScale = value; 267 | } 268 | 269 | /** 270 | * @brief Setter function for orbit mouse sensitivity. Parameter must 271 | * be between 1 and 100. 272 | * @param val 273 | * @retval none 274 | */ 275 | public void Set_Orbit_Sensitivity(float val) 276 | { 277 | val /= 100.0f; 278 | if(val < 1) 279 | { 280 | ortbitSensitivity = 0.01f; 281 | } 282 | else if(val > 1.0f) 283 | { 284 | ortbitSensitivity = 1.0f; 285 | } 286 | else 287 | { 288 | ortbitSensitivity = val; 289 | } 290 | } 291 | 292 | /** 293 | * @brief Getter function for orbit mouse sensitivity. 294 | * @param none 295 | * @retval ortbitSensitivity 296 | */ 297 | public float Get_Orbit_Sensitivity() 298 | { 299 | return ortbitSensitivity * 100.0f; 300 | } 301 | 302 | /** 303 | * @brief This function is using to update Pan and Orbit values. 304 | * This function needs to be called periodically during the 305 | * runtime in a timer or thread. Scale feature is working 306 | * event based (Mouse Wheel) so its not part of this function. 307 | * @param mouseX 308 | * @param mouseY 309 | * @retval none 310 | */ 311 | public void UpdateOrbiter(int mouseX, int mouseY) 312 | { 313 | difX = mouseX - mouseX_Old; 314 | difY = -(mouseY - mouseY_Old); /* set origin point to bottom left from top left */ 315 | mouseX_Old = mouseX; 316 | mouseY_Old = mouseY; 317 | if (enableOrbit) 318 | { 319 | orbitStr = Get_Orbit(difX, difY); 320 | } 321 | else if (enablePan) 322 | { 323 | PanX += difX; 324 | PanY += difY; 325 | } 326 | } 327 | 328 | /** 329 | * @brief This function is using to update Scale value whenever 330 | * mouse wheel event triggered on defined Control element. 331 | * This function needs to be added to selected form control 332 | * elements MouseWheel event as event function. 333 | * @param sender 334 | * @param e 335 | * @retval none 336 | */ 337 | public void Control_MouseWheelEvent(object sender, MouseEventArgs e) 338 | { 339 | scaleVal += (e.Delta > 0) ? 0.1f : -0.1f; 340 | if (scaleVal < 0.1f) 341 | { 342 | scaleVal = 0.1f; 343 | } 344 | else if (scaleVal > maxScale) 345 | { 346 | scaleVal = maxScale; 347 | } 348 | } 349 | 350 | /** 351 | * @brief This function is using to update Pan and Orbit enable flags. 352 | * This function needs to be added to selected form control 353 | * elements MouseDown event as event function. 354 | * @param sender 355 | * @param e 356 | * @retval none 357 | */ 358 | public void Control_MouseDownEvent(object sender, MouseEventArgs e) 359 | { 360 | enableOrbit = (e.Button == MouseButtons.Right); 361 | enablePan = (e.Button == MouseButtons.Left); 362 | } 363 | 364 | /** 365 | * @brief This function is using to update Pan and Orbit enable flags. 366 | * This function needs to be added to selected form control 367 | * elements MouseUp event as event function. 368 | * @param sender 369 | * @param e 370 | * @retval none 371 | */ 372 | public void Control_MouseUpEvent(object sender, MouseEventArgs e) 373 | { 374 | enableOrbit = (e.Button == MouseButtons.Right) ? false : enableOrbit; 375 | enablePan = (e.Button == MouseButtons.Left) ? false : enablePan; 376 | } 377 | 378 | /** 379 | * @brief This function is using to reset view to default when R key pressed. 380 | * This function needs to be added to selected form control 381 | * elements KeyPress event as event function. 382 | * @param sender 383 | * @param e 384 | * @retval none 385 | */ 386 | public void Control_KeyPress_Event(object sender, KeyPressEventArgs e) 387 | { 388 | if (e.KeyChar == 'r') 389 | { 390 | /* reset Orbit, Pan and Scale to default values */ 391 | Reset_All(); 392 | } 393 | } 394 | 395 | } 396 | } 397 | -------------------------------------------------------------------------------- /Mouse_Orbit/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Mouse_Orbit 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Mouse_Orbit/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Mouse_Orbit")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Mouse_Orbit")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d1467661-449a-451e-9061-e7cc8c774fb0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Mouse_Orbit/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Mouse_Orbit.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mouse_Orbit.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Mouse_Orbit/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Mouse_Orbit/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Mouse_Orbit.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Mouse_Orbit/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Mouse_Orbit/bin/Debug/Mouse_Orbit.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Mouse_Orbit/bin/Debug/OpenTK.Compatibility.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batu92k/Mouse-Orbit/98249777da1d8113c419f702bfcf4b25ee0730dd/Mouse_Orbit/bin/Debug/OpenTK.Compatibility.dll -------------------------------------------------------------------------------- /Mouse_Orbit/bin/Debug/OpenTK.GLControl.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batu92k/Mouse-Orbit/98249777da1d8113c419f702bfcf4b25ee0730dd/Mouse_Orbit/bin/Debug/OpenTK.GLControl.dll -------------------------------------------------------------------------------- /Mouse_Orbit/bin/Debug/OpenTK.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batu92k/Mouse-Orbit/98249777da1d8113c419f702bfcf4b25ee0730dd/Mouse_Orbit/bin/Debug/OpenTK.dll -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mouse Orbit 2 | This application performs **Mouse Orbit** (**quaternion based**), **Mouse Pan** and **Mouse Zoom** features to rotate, scale and move 3D objects similar like in the CAD programs. 3 | 4 | ![](orbit_features.gif) 5 | 6 | ## How to Use 7 | A Cube is drawn on the screen to visualize the features of the application. You can perform the mentioned features by following: 8 | * Hold right mouse button and move the mouse to rotate the Cube 9 | * Hold left mouse button and move the mouse to move the Cube 10 | * Use mouse wheel to scale the Cube 11 | * Press "R" to reset view 12 | 13 | -------------------------------------------------------------------------------- /orbit_features.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/batu92k/Mouse-Orbit/98249777da1d8113c419f702bfcf4b25ee0730dd/orbit_features.gif --------------------------------------------------------------------------------