Kaynağa Gözat

Added logging of TouchEvents.

Daniel Kauth 10 yıl önce
ebeveyn
işleme
7d0e7048e9

+ 8 - 0
bbiwarg/Graphics/OutputWindow.cs

@@ -126,6 +126,14 @@ namespace bbiwarg.Graphics
                 videoHandle.nextFrame();
             }
 
+            if (changedFrame)
+            {
+                foreach (PalmTouchEvent ev in videoHandle.getTouchEvents())
+                {
+                    Console.WriteLine("touch at " + ev.Position + " -> " + ev.RelativePalmPosition);
+                }
+            }
+
             //draw textures
             Int16[] depthTextureData = new Int16[3 * videoHandle.getWidth() * videoHandle.getHeight()];
             Int16[] edgeTextureData = new Int16[3 * videoHandle.getWidth() * videoHandle.getHeight()];

+ 5 - 5
bbiwarg/Utility/Quadrangle.cs

@@ -34,15 +34,15 @@ namespace bbiwarg.Utility
 
             float D = B * B - 4 * A * C;
 
-            float x = (-B - (float) Math.Sqrt(D)) / (2 * A);
+            float u = (-B - (float) Math.Sqrt(D)) / (2 * A);
 
-            float p1x = a.X + (b.X - a.X) * x;
-            float p2x = d.X + (c.X - d.X) * x;
+            float p1x = a.X + (b.X - a.X) * u;
+            float p2x = d.X + (c.X - d.X) * u;
             float px = p.X;
 
-            float y = (px - p1x) / (p2x - p1x);
+            float v = (px - p1x) / (p2x - p1x);
 
-            return new Vector2D(x, y);
+            return new Vector2D(v, u);
         }
     }
 }

+ 5 - 0
bbiwarg/VideoHandle.cs

@@ -123,6 +123,11 @@ namespace bbiwarg
             return touchImage.getStateAt(x, y);
         }
 
+        public List<PalmTouchEvent> getTouchEvents()
+        {
+            return palmTouchDetector.getPalmTouchEvents();
+        }
+
         private void processFrameUpdate()
         {
             //read data from inputProvider