Browse Source

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/etri-smartspaces

Alexander Hendrich 11 years ago
parent
commit
a3518b3538

+ 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()];

+ 1 - 10
bbiwarg/Images/TouchImage.cs

@@ -38,16 +38,7 @@ namespace bbiwarg.Images
             int size = 5;
             if (tis == TouchImageState.touchTracked || tis == TouchImageState.touchDetected)
             {
-                for (int i = x - size; i < x + size; i++)
-                {
-                    for (int j = y - size; j < y + size; j++)
-                    {
-                        if (i >= 0 && j >= 0 && i <= image.Width && j <= image.Height && Math.Sqrt(((x - i) * (x - i)) + ((y - j) * (y - j))) <= size)
-                        {
-                            image.Data[j, i, 0] = (byte)tis;
-                        }
-                    }
-                }
+                image.Draw(new CircleF(new System.Drawing.PointF(x, y), 5), new Gray((byte) tis), 0);
             }
         }
 

+ 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