Browse Source

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

Alexander Hendrich 10 years ago
parent
commit
6ce3bb216b

+ 121 - 1
bbiwarg/Parameters.cs

@@ -44,7 +44,7 @@ namespace bbiwarg
         /// <summary>
         /// the input source type
         /// </summary>
-        public static readonly InputType InputSource = InputType.Movie;
+        public static readonly InputType InputSource = InputType.Camera;
 
         /// <summary>
         /// path to the movie file used as input source
@@ -214,13 +214,44 @@ namespace bbiwarg
 
         #region finger tracking
 
+        /// <summary>
+        /// number of frames a finger needs to be detected before it is tracked
+        /// </summary>
         public static readonly int FingerTrackerNumFramesDetectedUntilTracked = 5;
+
+        /// <summary>
+        /// number of frames a finger needs to be lost before it is deleted
+        /// </summary>
         public static readonly int FingerTrackerNumFramesLostUntilDeleted = 10;
+
+        /// <summary>
+        /// xx entry for the measurement noise covariance matrix for the kalman filter used to smooth the finger hand and tip points
+        /// </summary>
         public static readonly float FingermXX = 0.000005f;
+
+        /// <summary>
+        /// xy and yx entry for the measurement noise covariance matrix for the kalman filter used to smooth the finger hand and tip points
+        /// </summary>
         public static readonly float FingermXY = 0.0f;
+
+        /// <summary>
+        /// yy entry for the measurement noise covariance matrix for the kalman filter used to smooth the finger hand and tip points
+        /// </summary>
         public static readonly float FingermYY = 0.000005f;
+
+        /// <summary>
+        /// number of finger slice directions used to compute the mean finger direction
+        /// </summary>
         public static readonly int FingerTrackerNumDirectionsForMeanDirection = 10;
+
+        /// <summary>
+        /// if the tip point of a finger moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float FingerTrackerMaxTipPointRelativeMove = TrackerMaxRelativeMove;
+
+        /// <summary>
+        /// if the hand point of a finger moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float FingerTrackerMaxHandPointRelativeMove = TrackerMaxRelativeMove;
 
         #endregion
@@ -228,12 +259,36 @@ namespace bbiwarg
 
         #region hand detection
         
+        /// <summary>
+        /// number of colors used to draw hands
+        /// </summary>
         public static readonly int HandNumColors = 3;
+
+        /// <summary>
+        /// maximum downwards depth difference between a pixel and a neighboring pixel belonging to the same hand
+        /// </summary>
         public static readonly int HandFloodFillDownDiff = 2;
+
+        /// <summary>
+        /// maximum upwards depth difference between a pixel and a neighboring pixel belonging to the same hand
+        /// </summary>
         public static readonly int HandFloodFillUpDiff = 2;
+
+        /// <summary>
+        /// maximum size of a hand relative to the whole image
+        /// </summary>
         public static readonly float HandMaxSize = 0.6f;
+
+        /// <summary>
+        /// minimum size of a hand realtive to the whole image
+        /// </summary>
         public static readonly float HandMinSize = 0.01f;
+
+        /// <summary>
+        /// maximum size of a hand extension mask relative to the whole image
+        /// </summary>
         public static readonly float HandExtensionMaxRelativeSize = 0.5f * HandMaxSize;
+
         public static readonly int HandExtendMaxDifference = 40;
         public static readonly float HandThumbDefectMaxDistanceToThumb = Parameters.FingerMaxWidth2D;
         public static readonly float HandThumbDefectMinThumbShortLengthRatio = 0.75f;
@@ -246,11 +301,34 @@ namespace bbiwarg
 
         #region hand tracker
 
+        /// <summary>
+        /// number of frames a hand needs to be detected before it is tracked
+        /// </summary>
         public static readonly int HandTrackerNumFramesDetectedUntilTracked = 5;
+
+        /// <summary>
+        /// number of frames a hand needs to be lost before it is deleted
+        /// </summary>
         public static readonly int HandTrackerNumFramesLostUntilDeleted = 5;
+
+        /// <summary>
+        /// if the centroid of a hand moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float HandTrackerMaxCentroidRelativeMove = TrackerMaxRelativeMove;
+
+        /// <summary>
+        /// xx entry for the measurement noise covariance matrix for the kalman filter used to smooth the hand centroid
+        /// </summary>
         public static readonly float HandmXX = 0.0005f;
+
+        /// <summary>
+        /// xy and yx entry for the measurement noise covariance matrix for the kalman filter used to smooth the hand centroid
+        /// </summary>
         public static readonly float HandmXY = 0.0f;
+
+        /// <summary>
+        /// yy entry for the measurement noise covariance matrix for the kalman filter used to smooth the hand centroid
+        /// </summary>
         public static readonly float HandmYY = 0.0005f;
 
         #endregion
@@ -258,7 +336,14 @@ namespace bbiwarg
 
         #region palm detection
 
+        /// <summary>
+        /// number of positions along the forefinger used as starting points to detect the palm width
+        /// </summary>
         public static readonly int PalmNumPositionsForPalmWidth = 5;
+
+        /// <summary>
+        /// relative tolerance which specifies when a point is considered to be in the palm grid
+        /// </summary>
         public static readonly float PalmInsideTolerance = 0.1f;
 
         #endregion
@@ -266,14 +351,49 @@ namespace bbiwarg
 
         #region palm tracker
 
+        /// <summary>
+        /// number of frames a palm needs to be detected before it is tracked
+        /// </summary>
         public static readonly int PalmTrackerNumFramesDetectedUntilTracked = 5;
+
+        /// <summary>
+        /// number of frames a palm needs to be lost before it is deleted
+        /// </summary>
         public static readonly int PalmTrackerNumFramesLostUntilDeleted = 5;
+
+        /// <summary>
+        /// if the upper wrist point of the palm grid moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float PalmTrackerMaxWristUpperRelativeMove = TrackerMaxRelativeMove;
+
+        /// <summary>
+        /// if the lower wrist point of the palm grid moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float PalmTrackerMaxWristLowerRelativeMove = TrackerMaxRelativeMove;
+
+        /// <summary>
+        /// if the upper finger point of the palm grid moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float PalmTrackerMaxFingersUpperRelativeMove = TrackerMaxRelativeMove;
+
+        /// <summary>
+        /// if the lower finger point of the palm grid moves this relative amount it will have a similarity of 0 to itself at the previous position
+        /// </summary>
         public static readonly float PalmTrackerMaxFingersLowerRelativeMove = TrackerMaxRelativeMove;
+
+        /// <summary>
+        /// xx entry for the measurement noise covariance matrix for the kalman filter used to smooth the palm grid points
+        /// </summary>
         public static readonly float PalmmXX = 0.00005f;
+
+        /// <summary>
+        /// xy and yx entry for the measurement noise covariance matrix for the kalman filter used to smooth the palm grid points
+        /// </summary>
         public static readonly float PalmmXY = 0.0f;
+
+        /// <summary>
+        /// yy entry for the measurement noise covariance matrix for the kalman filter used to smooth the palm grid points
+        /// </summary>
         public static readonly float PalmmYY = 0.00005f;
 
         #endregion

+ 9 - 1
bbiwarg/Recognition/HandRecognition/HandDetector.cs

@@ -92,6 +92,13 @@ namespace bbiwarg.Recognition.HandRecognition
                 if(!assignedFingers.Contains(finger)) {
                     Image<Gray, byte> handMask = getHandMask(finger.HandPoint);
 
+                    int numPixels = handMask.CountNonzero()[0];
+                    if (numPixels > Parameters.HandMaxSize * depthImage.Size.NumPixels)
+                    {
+                        assignedFingers.Add(finger);
+                        break;
+                    }
+
                     List<Finger> fingersOnHand = new List<Finger>();
                     List<Finger> fingersOnOtherHand = new List<Finger>();
 
@@ -121,7 +128,8 @@ namespace bbiwarg.Recognition.HandRecognition
         {
             Image<Gray, byte> mask = new Image<Gray, byte>(depthImage.Size.Width + 2, depthImage.Size.Height + 2);
             MCvConnectedComp comp = new MCvConnectedComp();
-            CvInvoke.cvFloodFill(modifiedHandDepthImage, p, new MCvScalar(255), new MCvScalar(Parameters.HandFloodFillDownDiff), new MCvScalar(Parameters.HandFloodFillUpDiff), out comp, Emgu.CV.CvEnum.CONNECTIVITY.FOUR_CONNECTED, Emgu.CV.CvEnum.FLOODFILL_FLAG.DEFAULT, mask);
+            CvInvoke.cvFloodFill(modifiedHandDepthImage, p, new MCvScalar(255), new MCvScalar(Parameters.HandFloodFillDownDiff), 
+                new MCvScalar(Parameters.HandFloodFillUpDiff), out comp, Emgu.CV.CvEnum.CONNECTIVITY.FOUR_CONNECTED, Emgu.CV.CvEnum.FLOODFILL_FLAG.DEFAULT, mask);
             return mask.Copy(new Rectangle(1, 1, depthImage.Size.Width, depthImage.Size.Height));
         }
 

+ 3 - 3
bbiwarg/Utility/Line2D.cs

@@ -32,7 +32,7 @@ namespace bbiwarg.Utility
         public Vector2D Direction { get; private set; }
 
         /// <summary>
-        /// Standard constructor which sets the essential attributes
+        /// Standard constructor which sets the essential attributes.
         /// </summary>
         /// <param name="pointOnLine"><see cref="PointOnLine"/></param>
         /// <param name="direction"><see cref="Direction"/></param>
@@ -54,7 +54,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// Calculates whether a point is above, below or on this line
+        /// Calculates whether a point is above, below or on this line.
         /// </summary>
         /// <param name="point">point which is used to compute the side</param>
         /// <returns>LineSide.above iff point is above this, LineSide.below iff point is below this, LineSide.onLine iff point is on this line</returns>
@@ -90,7 +90,7 @@ namespace bbiwarg.Utility
         }
         
         /// <summary>
-        /// Computes the intersection of two lines, iff the lines do not intersect it returns null
+        /// Computes the intersection of two lines, iff the lines do not intersect it returns null.
         /// </summary>
         /// <param name="line">the second line</param>
         /// <returns>the intersection or null iff the lines do not intersect</returns>

+ 7 - 7
bbiwarg/Utility/LineSegment2D.cs

@@ -22,22 +22,22 @@ namespace bbiwarg.Utility
         public Vector2D P2 { get; private set; }
 
         /// <summary>
-        /// Direction Vector of the line which contains the lineSegment
+        /// direction vector of the line which contains the lineSegment
         /// </summary>
         public Vector2D Direction { get { return Line.Direction; } }
 
         /// <summary>
-        /// Line which contains the lineSegment
+        /// line which contains the lineSegment
         /// </summary>
         public Line2D Line { get; private set; }
 
         /// <summary>
-        /// Length of the LineSegment
+        /// length of the LineSegment
         /// </summary>
         public float Length { get; private set; }
 
         /// <summary>
-        /// Standard contructor which sets the essential attributes
+        /// Standard contructor which sets the essential attributes.
         /// </summary>
         /// <param name="p1">first point of LineSegment<see cref="P1"/></param>
         /// <param name="p2">second point of LineSegment<see cref="P2"/></param>
@@ -52,7 +52,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// Computes the intersection of two LineSegments, iff they do not intersect returns null
+        /// Computes the intersection of two LineSegments, iff they do not intersect returns null.
         /// </summary>
         /// <param name="ls">second LineSegment</param>
         /// <returns>Intersection iff its defined, else null</returns>
@@ -62,7 +62,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// Computes the Distance of two parallel LineSegments, iff they are not parallel it returns 0
+        /// Computes the Distance of two parallel LineSegments, iff they are not parallel it returns 0.
         /// </summary>
         /// <param name="line">second LineSegment</param>
         /// <returns>Distance between the LineSegment</returns>
@@ -98,7 +98,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// Computes the shortest distance of a point to the LineSegment
+        /// Computes the shortest distance of a point to the LineSegment.
         /// </summary>
         /// <param name="point">the point for distance calculation</param>
         /// <returns>the distance</returns>

+ 3 - 3
bbiwarg/Utility/Quadrangle.cs

@@ -44,7 +44,7 @@ namespace bbiwarg.Utility
         public Vector2D[] Corners { get { return new Vector2D[4] { TopLeft, TopRight, BottomRight, BottomLeft }; } }
 
         /// <summary>
-        /// Standard constructor of quadrangle, which sets the 4 points
+        /// Standard constructor of quadrangle, which sets the 4 points.
         /// </summary>
         /// <param name="topLeft">top left point <see cref="topLeft"/></param>
         /// <param name="topRight">top right point <see cref="topRight"/></param>
@@ -59,7 +59,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// Computes the relative position of a point inside the quadrangle, iff the point is inside the output varies between (0,0) and (1,1), else it is smaller or greater
+        /// Computes the relative position of a point inside the quadrangle, iff the point is inside the output varies between (0,0) and (1,1), else it is smaller or greater.
         /// </summary>
         /// <param name="p">the point which relative position should be computed</param>
         /// <returns>a point between (0,0) and (1,1), iff the point is inside the quadrangle</returns>
@@ -90,7 +90,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// Checks whether a point is inside the quadrangle or not, a tolerance can be set, which allows that the decision is based on a quadrangle which is tolerance times greater/smaller than the original quadrangle
+        /// Checks whether a point is inside the quadrangle or not, a tolerance can be set, which allows that the decision is based on a quadrangle which is tolerance times greater/smaller than the original quadrangle.
         /// </summary>
         /// <param name="point">the point</param>
         /// <param name="tolerance">the tolerance value</param>

+ 194 - 26
bbiwarg/Utility/Vector2D.cs

@@ -7,69 +7,144 @@ using System.Threading.Tasks;
 
 namespace bbiwarg.Utility
 {
+    /// <summary>
+    /// Class with represents a vector or a point in 2 dimensional space.  
+    /// </summary>
     public class Vector2D
     {
+
+        /// <summary>
+        /// length of the vector, is initialized with -1 and will only be calculated if needed and only once
+        /// </summary>
+        private float length = -1;
+        
+        /// <summary>
+        /// the null vector or origin
+        /// </summary>
         public static Vector2D Zero { get { return new Vector2D(0, 0); } }
+
+        /// <summary>
+        /// X (first) component
+        /// </summary>
         public float X { get; private set; }
+
+        /// <summary>
+        /// Y (second) component
+        /// </summary>
         public float Y { get; private set; }
+
+        /// <summary>
+        /// X component as integer
+        /// </summary>
         public int IntX { get { return (int)X; } }
+
+        /// <summary>
+        /// Y component as integer
+        /// </summary>
         public int IntY { get { return (int)Y; } }
-        public float Length { get { return (float)Math.Sqrt(X * X + Y * Y); } }
-        
+
+        /// <summary>
+        /// length of the vector, computed in euclidean distance (2. norm)
+        /// </summary>
+        public float Length { get { if (length == -1) length = (float)Math.Sqrt(X * X + Y * Y); return length; } }
+
+        /// <summary>
+        /// Standard constructor which sets the components.
+        /// </summary>
+        /// <param name="x">first component</param>
+        /// <param name="y">second component</param>
         public Vector2D(float x, float y)
         {
             X = x;
             Y = y;
         }
 
-        public Vector2D(Vector2D vec)
-        {
-            X = vec.X;
-            Y = vec.Y;
-        }
-
+        /// <summary>
+        /// Constructor to create a Vector2D from a Point .
+        /// </summary>
+        /// <param name="point">a Point</param>
         public Vector2D(Point point)
         {
             X = point.X;
             Y = point.Y;
         }
 
+        /// <summary>
+        /// Constructor to create a Vector2D from a PointF.
+        /// </summary>
+        /// <param name="point">a PointF</param>
         public Vector2D(PointF point)
         {
             X = point.X;
             Y = point.Y;
         }
 
+        /// <summary>
+        /// Computes the euclidean distance between the point this vector describes and another point described by a Vector.
+        /// </summary>
+        /// <param name="point">a Point</param>
+        /// <returns>euclidean distance</returns>
         public float getDistanceTo(Vector2D point)
         {
             return (this - point).Length;
         }
 
+        /// <summary>
+        /// Computes the angle between this vector and another vector in radians.
+        /// </summary>
+        /// <param name="vector">a vector</param>
+        /// <returns>angle in radians</returns>
         public float getAngleBetween(Vector2D vector)
         {
             return (float)Math.Acos(dotProduct(vector) / (Length * vector.Length));
         }
 
+        /// <summary>
+        /// Computes whether this vector and another vector point in opposite directions, meaning the smallest angle is between 90° and 180°.
+        /// </summary>
+        /// <param name="vector">a vector</param>
+        /// <returns>true iff the vectors point in opposite directions</returns>
         public bool isInOppositeDirection(Vector2D vector)
         {
             return (getAngleBetween(vector) > Math.PI / 2);
         }
 
+        /// <summary>
+        /// Computes the dot product of this vector and another vector.
+        /// </summary>
+        /// <param name="vector">the other vector</param>
+        /// <returns>the dot product</returns>
         public float dotProduct(Vector2D vector)
         {
             return X * vector.X + Y * vector.Y;
         }
 
+        /// <summary>
+        /// Computes the cross product (determinant) of this vector and another vector.
+        /// </summary>
+        /// <param name="v">the other vector</param>
+        /// <returns>cross product of this and v</returns>
         public float crossProduct(Vector2D v)
         {
             return X * v.Y - Y * v.X;
         }
 
+        /// <summary>
+        /// Multiplies this vector component-by-component with another vector.
+        /// </summary>
+        /// <param name="v">the other vector</param>
+        /// <returns>the component-by-component multiplied vector</returns>
         public Vector2D scale(Vector2D v)
         {
             return new Vector2D(X * v.X, Y * v.Y);
         }
 
+        /// <summary>
+        /// Determines whether this point (vector) is inside a given box or not.
+        /// </summary>
+        /// <param name="corner1">first corner of the box</param>
+        /// <param name="corner2">second corner of the box</param>
+        /// <returns>true iff point is inside the box</returns>
         public bool isInBox(Vector2D corner1, Vector2D corner2)
         {
             float minX = Math.Min(corner1.X, corner2.X);
@@ -79,42 +154,62 @@ namespace bbiwarg.Utility
             return (minX <= X && X <= maxX && minY <= Y && Y <= maxY);
         }
 
+        /// <summary>
+        /// Determines whether a this point is inside the boundaries of a given image or not. 
+        /// </summary>
+        /// <param name="imageSize">a imageSize object</param>
+        /// <returns>true iff point is inside the image boundaries</returns>
         public bool isInBound(ImageSize imageSize)
         {
             return isInBound(Vector2D.Zero, imageSize.MaxPixel);
         }
 
+        /// <summary>
+        /// Determines whether a point is inside a box. iff bottomRight is higher or more left than topLeft the result is false.
+        /// </summary>
+        /// <param name="topLeft">top left corner of the box</param>
+        /// <param name="bottomRight">bottom right corner of the box</param>
+        /// <returns>true iff point is in box</returns>
         public bool isInBound(Vector2D topLeft, Vector2D bottomRight)
         {
             return (X >= topLeft.X && X <= bottomRight.X && Y >= topLeft.Y && Y <= bottomRight.Y);
         }
-
-        public Vector2D moveInBound(ImageSize imageSize, Vector2D inBoundDirection)
-        {
-            return moveInBound(Vector2D.Zero, imageSize.MaxPixel, inBoundDirection);
-        }
-
-        public Vector2D moveInBound(Vector2D topLeft, Vector2D bottomRight, Vector2D inBoundDirection)
+        
+        /// <summary>
+        /// Moves this vector along the direction vector factor times inside the imageSize, this point won't leave the image.
+        /// </summary>
+        /// <param name="imageSize">the imagesize</param>
+        /// <param name="direction">the move direction</param>
+        /// <param name="factor">the move factor</param>
+        /// <returns>a point inside the image</returns>
+        public Vector2D moveWithinBound(ImageSize imageSize, Vector2D direction, float factor)
         {
-            Vector2D position = new Vector2D(X, Y);
-            while (!position.isInBound(topLeft, bottomRight))
-                position += inBoundDirection;
-            return position;
-        }
-
-        public Vector2D moveWithinBound(ImageSize imageSize, Vector2D direction, float factor) {
             Vector2D newPosition = this + factor * direction;
             if (!newPosition.isInBound(imageSize))
-                newPosition = newPosition.moveInBound(imageSize, direction.getInverse());
+            {
+                Vector2D inverseDirection = direction.getInverse().normalize();
+                while (!newPosition.isInBound(imageSize))
+                {
+                    newPosition += inverseDirection;
+                }
+            }
             return newPosition;
         }
-
+        
+        /// <summary>
+        /// Normalizes this vector with the euclidean norm (2. norm).
+        /// </summary>
+        /// <returns>normalized vector</returns>
         public Vector2D normalize()
         {
-            float length = Length;
-            return new Vector2D(X / length, Y / length);
+            return new Vector2D(X / Length, Y / Length);
         }
 
+        /// <summary>
+        /// Computes a orthogonal vector of this vector, if side is true the X component will be switched, else the Y component.
+        /// </summary>
+        /// <param name="side">which vector</param>
+        /// <returns>a orthogonal vector</returns>
         public Vector2D getOrthogonal(bool side = true)
         {
             if (side)
@@ -123,61 +218,124 @@ namespace bbiwarg.Utility
                 return new Vector2D(-Y, X);
         }
 
+        /// <summary>
+        /// Computes the inverse vector of this vector.
+        /// </summary>
+        /// <returns>inverse vector</returns>
         public Vector2D getInverse()
         {
             return new Vector2D(-X, -Y);
         }
 
+        /// <summary>
+        /// Computes the absolute vector of this vector.
+        /// </summary>
+        /// <returns>absolute vector</returns>
         public Vector2D getAbsolute()
         {
             return new Vector2D(Math.Abs(X), Math.Abs(Y));
         }
 
+        /// <summary>
+        /// Copies this vector (clone).
+        /// </summary>
+        /// <returns>this vector as new vector</returns>
         public Vector2D copy()
         {
             return new Vector2D(X, Y);
         }
 
+        /// <summary>
+        /// Creates a description of this vector.
+        /// </summary>
+        /// <returns>a string describing this vector</returns>
         public override string ToString()
         {
             return "(" + X + "|" + Y + ")";
         }
 
+        /// <summary>
+        /// Multiplies this vector component-by-component with a scalar value.
+        /// </summary>
+        /// <param name="scalar">multiplier</param>
+        /// <param name="vector">multiplicant</param>
+        /// <returns>multiplied vector (product)</returns>
         public static Vector2D operator *(float scalar, Vector2D vector)
         {
             return new Vector2D(scalar * vector.X, scalar * vector.Y);
         }
 
+        /// <summary>
+        /// Multiplies this vector component-by-component with a scalar value.
+        /// </summary>
+        /// <param name="vector">multiplicant</param>
+        /// <param name="scalar">multiplier</param>
+        /// <returns>multiplied vector (product)</returns>
         public static Vector2D operator *(Vector2D vector, float scalar)
         {
             return new Vector2D(scalar * vector.X, scalar * vector.Y);
         }
 
+        /// <summary>
+        /// Divides this vector with a scalar value.
+        /// </summary>
+        /// <param name="vector">this vector</param>
+        /// <param name="scalar">the value</param>
+        /// <returns>the divided vector</returns>
         public static Vector2D operator /(Vector2D vector, float scalar)
         {
             return new Vector2D(vector.X / scalar, vector.Y / scalar);
         }
+
+        /// <summary>
+        /// Divides on vector with another vector component-by-component.
+        /// </summary>
+        /// <param name="vector1">the dividend</param>
+        /// <param name="vector2">the divisor</param>
+        /// <returns>the component divided vector</returns>
         public static Vector2D operator /(Vector2D vector1, Vector2D vector2)
         {
             return new Vector2D(vector1.X / vector2.X, vector1.Y / vector2.Y);
         }
 
+        /// <summary>
+        /// Adds two vectors (component-by-component).
+        /// </summary>
+        /// <param name="vector1">first addend</param>
+        /// <param name="vector2">second addend</param>
+        /// <returns>sum of the vectors</returns>
         public static Vector2D operator +(Vector2D vector1, Vector2D vector2)
         {
             return new Vector2D(vector1.X + vector2.X, vector1.Y + vector2.Y);
         }
 
+        /// <summary>
+        /// Subtracts two vectors (component-by-component).
+        /// </summary>
+        /// <param name="vector1">the minuend</param>
+        /// <param name="vector2">the subtrahend</param>
+        /// <returns>the difference of the two vectors</returns>
         public static Vector2D operator -(Vector2D vector1, Vector2D vector2)
         {
             return new Vector2D(vector1.X - vector2.X, vector1.Y - vector2.Y);
         }
 
+        /// <summary>
+        /// Computes the mean of two vectors.
+        /// </summary>
+        /// <param name="vectors">second vector</param>
+        /// <returns>the mean vector</returns>
         public static Vector2D mean(List<Vector2D> vectors)
         {
             Vector2D sumVector = Vector2D.sum(vectors);
             return sumVector / vectors.Count;
         }
 
+        /// <summary>
+        /// Sums a list of vectors (component-by-component).
+        /// </summary>
+        /// <param name="vectors">a list of vectors</param>
+        /// <returns>vector of sumed components</returns>
         public static Vector2D sum(List<Vector2D> vectors)
         {
             Vector2D sumVector = new Vector2D(0, 0);
@@ -187,11 +345,21 @@ namespace bbiwarg.Utility
             return sumVector;
         }
 
+        /// <summary>
+        /// Casts a Vector2D to PointF.
+        /// </summary>
+        /// <param name="vec">a vector</param>
+        /// <returns>a PointF</returns>
         public static implicit operator PointF(Vector2D vec)
         {
             return new PointF(vec.X, vec.Y);
         }
 
+        /// <summary>
+        /// Casts a Vector2D to Point.
+        /// </summary>
+        /// <param name="vec">a vector</param>
+        /// <returns>a Point</returns>
         public static implicit operator Point(Vector2D vec)
         {
             return new Point(vec.IntX, vec.IntY);

+ 8 - 8
bbiwarg/Utility/Vector3D.cs

@@ -47,7 +47,7 @@ namespace bbiwarg.Utility
         public float Length { get { return (float)Math.Sqrt(X * X + Y * Y + Z * Z); } }
 
         /// <summary>
-        /// Standard constructor which sets the 3 components
+        /// Standard constructor which sets the 3 components.
         /// </summary>
         /// <param name="x">first component</param>
         /// <param name="y">second component</param>
@@ -61,7 +61,7 @@ namespace bbiwarg.Utility
 
         /// <summary>
         /// Computes the distance from the point this vector describes to another 3D point (vector).
-        /// the distance is the euclidean distance (2. Norm)
+        /// The distance is the euclidean distance (2. Norm).
         /// </summary>
         /// <param name="point">the other point</param>
         /// <returns>euclidean distance between this and point</returns>
@@ -71,7 +71,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// multiplies this vector with a scalar value
+        /// Multiplies this vector with a scalar value.
         /// </summary>
         /// <param name="scalar">the value</param>
         /// <param name="v">this vector</param>
@@ -82,7 +82,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// multiplies this vector with a scalar value
+        /// Multiplies this vector with a scalar value.
         /// </summary>
         /// <param name="v">this vector</param>
         /// <param name="scalar">the value</param>
@@ -93,7 +93,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// divides this vector with a scalar value
+        /// Divides this vector with a scalar value.
         /// </summary>
         /// <param name="v">this vector</param>
         /// <param name="scalar">the value</param>
@@ -104,7 +104,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// divides on vector with another vector component-by-component
+        /// Divides on vector with another vector component-by-component.
         /// </summary>
         /// <param name="v1">the dividend</param>
         /// <param name="v2">the divisor</param>
@@ -115,7 +115,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// adds two vectors (component-by-component)
+        /// Adds two vectors (component-by-component).
         /// </summary>
         /// <param name="v1">first addend</param>
         /// <param name="v2">second addend</param>
@@ -126,7 +126,7 @@ namespace bbiwarg.Utility
         }
 
         /// <summary>
-        /// subtracts two vectors (component-by-component)
+        /// Subtracts two vectors (component-by-component).
         /// </summary>
         /// <param name="v1">the minuend</param>
         /// <param name="v2">the subtrahend</param>