Tag Archives: C#

“Until” extension method for integers in C#

I wrote this simple snippet today, and thought I’d share: public static IEnumerable<int> Until(this int from, int to) { for (int i = from; i <= to; i++) { yield return i; } } Its purpose is to return number … Continue reading

Posted in C# | Tagged , | Leave a comment

PointCloudNI

I felt like playing around with the Kinect some more this evening, so I put together a point cloud in Unity3D. This takes the base code from TrackingNI and with a little help from Marshal, it can pull the depth … Continue reading

Posted in C#, Kinect, Virtual Reality | Tagged , , , , | 15 Comments

TrackingNI: Depth Correction

If you’ve been following my MouseNI or TrackingNI demos, then this one is somewhat more interesting. I had a little more free time today and thought I’d try my hand at filling in the IR shadow in the Kinect’s depth … Continue reading

Posted in C#, Kinect, Virtual Reality | Tagged , , , | 5 Comments

TrackingNI: Simple Skeleton, Hand and Head Tracking

This is a follow-up to my MouseNI post. We got some more time to work with the Kinect yesterday and finally got the skeletal tracking working in C# with WPF.  Based solely on the skeletal data, it also draws circles … Continue reading

Posted in C#, Kinect, Virtual Reality | Tagged , , , , , | 14 Comments

C# Object Cloner

I recently came across the need to replicate large numbers of objects, so I will share this nice piece of code. The following snippet is a class for deep cloning of objects (usually instances of classes) in C# posted by … Continue reading

Posted in C# | Tagged , , , | Leave a comment

MouseNI

I managed to get enough free time today to play around with the Kinect. Using the OpenNI drivers and NITE middleware, I made this very simple mouse controller with hand tracking in C#: More to come soon, hopefully!Update: I have … Continue reading

Posted in C#, Kinect, Virtual Reality | Tagged , , , , , | 3 Comments

Extending C# Enumerators with Methods

Although I personally find C# enumerators to be atrocious, they still have several advantages over constant integers.  One of these advantages is the ability to extend the object with additional logic.  This is accomplished by binding extension methods at compile … Continue reading

Posted in C# | Tagged , , | Leave a comment

Generic Singleton Pattern in C# with Reflection

Reusable and proven design patterns are crucial to building robust and scalable applications.  I loathe copying and pasting boilerplate code; naturally, I always prefer abstract classes and interfaces when possible.  And frequently, I end up employing a singleton pattern when … Continue reading

Posted in C# | Tagged , , , | 1 Comment