//Using statements omitted /// /// A simple struct that stores information describing a clump of bright pixels. This clump is then /// matched with a laser dot being tracked from the previous frame or is identified as a new laser dot. /// public struct PixelClump { /* * STRUCT PROPERTIES */ /// /// clump position from average pixel position /// public Vector2d AveragePosition; /// /// the average pixel position in this clump /// public Point PositionSum; /// /// the sum of all pixel weights /// public int TotalWeight; /// /// the average pixel weight /// public int AverageWeight; /// /// the number of pixels in this clump /// public int NumPixels; /// /// indicates if this clump has been claimed by a laser dot /// public Boolean Claimed; /// /// the laser dot that claims this laser dot /// public LaserDot LaserDot; /// /// the distance of this laser dot from the expected position /// public double DistanceFromExpected; /* * CONSTRUCTOR */ /// /// the constructor for a new pixel clump /// public PixelClump(bool newClaimed) { PositionSum = new Point(0, 0); TotalWeight = 0; NumPixels = 0; AveragePosition = Vector2d.Zero; AverageWeight = 0; Claimed = newClaimed; LaserDot = null; DistanceFromExpected = 0; } /* * CLAIM / UNCLAIM */ /// /// claims the laser dot as belonging to the specified laser dot /// /// the laser dot claiming this pixel clump /// the distance from the expected laser dot position to this clump's position public void claim(LaserDot dot, double distance) { Claimed = true; LaserDot = dot; DistanceFromExpected = distance; } /// /// sets this clump to be unclaimed by any laser dots /// public void unclaim() { LaserDot.unclaim(); Claimed = false; LaserDot = null; DistanceFromExpected = 0; } }