Browse Source

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

Alexander Hendrich 10 years ago
parent
commit
cb8cf9fb55

+ 4 - 4
bbiwarg/Input/InputProviding/InputProvider.cs

@@ -102,12 +102,12 @@ namespace bbiwarg.Input.InputProviding
         protected IParameterHandle<int> height;
 
         /// <summary>
-        /// parameter handle for the horizontal field of view
+        /// parameter handle for the horizontal field of view angle
         /// </summary>
         protected IParameterHandle<float> hfov;
 
         /// <summary>
-        /// parameter handle for the vertical field of view
+        /// parameter handle for the vertical field of view angle
         /// </summary>
         protected IParameterHandle<float> vfov;
 
@@ -132,12 +132,12 @@ namespace bbiwarg.Input.InputProviding
         public int ImageHeight { get { return height.Value; } }
 
         /// <summary>
-        /// the horizontal field of view
+        /// the horizontal field of view angle
         /// </summary>
         public float HFOV { get { return hfov.Value; } }
 
         /// <summary>
-        /// the vertical field of view
+        /// the vertical field of view angle
         /// </summary>
         public float VFOV { get { return vfov.Value; } }
 

+ 116 - 10
bbiwarg/TUIO/TUIO/TuioServer.cs

@@ -11,30 +11,85 @@ using bbiwarg.Utility;
 
 namespace TUIO
 {
+    /// <summary>
+    /// Tuio server class to send tuio cursors and objects to tuio clients.
+    /// </summary>
     class TuioServer
     {
+        /// <summary>
+        /// the maximum packet size
+        /// </summary>
         const int MAX_PACKET_SIZE = 65535 - 8;
 
+
+        /// <summary>
+        /// transmitter to send packages over udp
+        /// </summary>
         private OSCTransmitter transmitter = null;
+
+        /// <summary>
+        /// server ip address
+        /// </summary>
         private String host = "127.0.0.1";
+
+        /// <summary>
+        /// server port
+        /// </summary>
         private int port = 3333;
+
+        /// <summary>
+        /// tuio session id
+        /// </summary>
         private long sessionID = 0;
+
+        /// <summary>
+        /// current tuio time
+        /// </summary>
         private TuioTime currentFrameTime;
 
+
+        /// <summary>
+        /// list of generated cursors
+        /// </summary>
         private List<TuioCursor> cursorList;
+
+        /// <summary>
+        /// list of cursors updated in the current frame
+        /// </summary>
         private List<TuioCursor> updatedCursorList;
 
+
+        /// <summary>
+        /// list of all generated objects
+        /// </summary>
         private List<TuioObject> objectList;
+
+        /// <summary>
+        /// list of objects updated in the current frame
+        /// </summary>
         private List<TuioObject> updatedObjectList;
 
+
+        /// <summary>
+        /// Creates a tuio server with default ip and port.
+        /// </summary>
         public TuioServer() { init(); }
 
+        /// <summary>
+        /// Creates a tuio server with default ip.
+        /// </summary>
+        /// <param name="port">server port</param>
         public TuioServer(int port)
         {
             this.port = port;
             init();
         }
 
+        /// <summary>
+        /// Creates a tuio server.
+        /// </summary>
+        /// <param name="host">server ip</param>
+        /// <param name="port">server port</param>
         public TuioServer(String host, int port)
         {
             this.host = host;
@@ -42,6 +97,9 @@ namespace TUIO
             init();
         }
 
+        /// <summary>
+        /// Initializes the server, cursors and objects.
+        /// </summary>
         private void init()
         {
             TuioTime.initSession();
@@ -50,12 +108,20 @@ namespace TUIO
             transmitter = new OSCTransmitter(host, port);
         }
 
-
+        /// <summary>
+        /// Closes the transmission.
+        /// </summary>
         public void close()
         {
             transmitter.Close();
         }
 
+        /// <summary>
+        /// Adds and returns a tuio cursor.
+        /// </summary>
+        /// <param name="xp">x position of the cursor</param>
+        /// <param name="yp">y position of the cursor</param>
+        /// <returns>the added cursor</returns>
         public TuioCursor addTuioCursor(float xp, float yp)
         {
             TuioCursor tcur = new TuioCursor(sessionID, cursorList.Count, xp, yp);
@@ -66,6 +132,12 @@ namespace TUIO
             return tcur;
         }
 
+        /// <summary>
+        /// Updates a tui cursor.
+        /// </summary>
+        /// <param name="tcur">the cursor to update</param>
+        /// <param name="xp">new x position</param>
+        /// <param name="yp">new y position</param>
         public void updateTuioCursor(TuioCursor tcur, float xp, float yp)
         {
             tcur.update(currentFrameTime, xp, yp);
@@ -73,11 +145,22 @@ namespace TUIO
                 updatedCursorList.Add(tcur);
         }
 
+        /// <summary>
+        /// Removes a tuio cursor.
+        /// </summary>
+        /// <param name="tcur">the cursor to remove</param>
         public void removeTuioCursor(TuioCursor tcur)
         {
             cursorList.Remove(tcur);
         }
 
+        /// <summary>
+        /// Adds and returns tuio object.
+        /// </summary>
+        /// <param name="xp">x position of the object</param>
+        /// <param name="yp">y position of the object</param>
+        /// <param name="angle">angle of the object</param>
+        /// <returns>the added object</returns>
         public TuioObject addTuioObject(float xp, float yp, float angle)
         {
             TuioObject tobj = new TuioObject(sessionID, objectList.Count, xp, yp, angle);
@@ -88,6 +171,12 @@ namespace TUIO
             return tobj;
         }
 
+        /// <summary>
+        /// Updates a tuio object.
+        /// </summary>
+        /// <param name="tobj">the object to update</param>
+        /// <param name="xp">new x position</param>
+        /// <param name="yp">new y position</param>
         public void updateTuioObject(TuioObject tobj, float xp, float yp)
         {
             tobj.update(currentFrameTime, xp, yp);
@@ -95,11 +184,18 @@ namespace TUIO
                 updatedObjectList.Add(tobj);
         }
 
+        /// <summary>
+        /// Removes a tuio object.
+        /// </summary>
+        /// <param name="tobj">the object to remove</param>
         public void removeTuioObject(TuioObject tobj)
         {
             objectList.Remove(tobj);
         }
 
+        /// <summary>
+        /// Initializes cursor and object lists for sending information for a new frame.
+        /// </summary>
         public void initFrame()
         {
             currentFrameTime = TuioTime.getSessionTime();
@@ -107,16 +203,27 @@ namespace TUIO
             updatedObjectList = new List<TuioObject>();
         }
 
+        /// <summary>
+        /// Sends cursors and objects which were updated in the current frame.
+        /// </summary>
         public void commitFrame()
         {
             sendMessage(updatedCursorList, updatedObjectList);
         }
 
+        /// <summary>
+        /// Sends all cursors and objects.
+        /// </summary>
         public void sendFullMessages()
         {
             sendMessage(cursorList, objectList);
         }
 
+        /// <summary>
+        /// Sends cursors and objects.
+        /// </summary>
+        /// <param name="cursorList">list of cursors to send</param>
+        /// <param name="objectList">list of objects to send</param>
         private void sendMessage(List<TuioCursor> cursorList, List<TuioObject> objectList)
         {
             OSCBundle packet = new OSCBundle();
@@ -136,15 +243,6 @@ namespace TUIO
                 currentMessage.Append(tcur.getXSpeed());
                 currentMessage.Append(tcur.getYSpeed());
                 currentMessage.Append(tcur.getMotionAccel());
-
-                /*if (Marshal.SizeOf(packet) + Marshal.SizeOf(currentOscElement) >= MAX_PACKET_SIZE)
-                {
-                    packet.AddElement(new OscElement("/tuio/2Dcur", new Object[] { "fseq", -1 }));
-                    udpwriter.Send(packet);
-
-                    packet = new OscBundle();
-                    addAliveCursorMessagesToBundle(packet);
-                }*/
                 packet.Append(currentMessage);
             }
             currentMessage = new OSCMessage("/tuio/2Dcur");
@@ -185,6 +283,10 @@ namespace TUIO
             transmitter.Send(packet);
         }
 
+        /// <summary>
+        /// Adds a tuio cursor alive message to a packet.
+        /// </summary>
+        /// <param name="packet">packet to add the message to</param>
         private void addAliveCursorMessagesToBundle(OSCBundle packet)
         {
             OSCMessage mssg = new OSCMessage("/tuio/2Dcur");
@@ -196,6 +298,10 @@ namespace TUIO
             packet.Append(mssg);
         }
 
+        /// <summary>
+        /// Adds a tuio object alive message to a packet.
+        /// </summary>
+        /// <param name="packet">packet to add the message to</param>
         private void addAliveObjectMessagesToBundle(OSCBundle packet)
         {
             OSCMessage mssg = new OSCMessage("/tuio/2Dobj");

+ 43 - 0
bbiwarg/TUIO/TuioCommunicator.cs

@@ -13,12 +13,32 @@ using TUIO;
 
 namespace bbiwarg.TUIO
 {
+    /// <summary>
+    /// TuioCommunicator sends generated touch events and palm grid coordinates to tuio clients using a <see cref="TuioServer"/>.
+    /// </summary>
     class TuioCommunicator
     {
+        /// <summary>
+        /// the tuio server
+        /// </summary>
         private TuioServer server;
+
+        /// <summary>
+        /// dictionary of lists of tuio cursors indexed by touch id
+        /// </summary>
         private Dictionary<int, TuioCursor> tcursors;
+
+        /// <summary>
+        /// dictionary of lists of tuio objects indexed by palm id
+        /// </summary>
         private Dictionary<int, List<TuioObject>> tobjects;
 
+
+        /// <summary>
+        /// Constructs a TuioCommunicator.
+        /// </summary>
+        /// <param name="host">server ip</param>
+        /// <param name="port">server port</param>
         public TuioCommunicator(string host, int port)
         {
             server = new TuioServer(host, port);
@@ -26,6 +46,11 @@ namespace bbiwarg.TUIO
             tobjects = new Dictionary<int, List<TuioObject>>();
         }
 
+        /// <summary>
+        /// Handles the event that a new frame is finished processing by updating the cursors and objects and sending them.
+        /// </summary>
+        /// <param name="sender">event sender</param>
+        /// <param name="e">event arguments</param>
         public void handleNewFrameData(object sender, NewProcessedFrameEventArgs e)
         {
             server.initFrame();
@@ -93,11 +118,17 @@ namespace bbiwarg.TUIO
             server.commitFrame();
         }
 
+        /// <summary>
+        /// Closes the server.
+        /// </summary>
         public void close()
         {
             server.close();
         }
 
+        /// <summary>
+        /// Resets the server by removing all cursors and objects.
+        /// </summary>
         public void reset()
         {
             foreach (int id in tcursors.Keys)
@@ -112,6 +143,12 @@ namespace bbiwarg.TUIO
             tobjects.Clear();
         }
 
+        /// <summary>
+        /// Tries to parse an ip address string.
+        /// </summary>
+        /// <param name="ipIn">the ip address string to parse</param>
+        /// <param name="ipOut">out parameter for the ip address in *.*.*.* format if ipIn is valid and null otherwise</param>
+        /// <returns>true iff ipIn is a valid ip address</returns>
         public static bool tryParseIPAddress(String ipIn, out String ipOut)
         {
             IPAddress ipAddress;
@@ -123,6 +160,12 @@ namespace bbiwarg.TUIO
             return result;
         }
 
+        /// <summary>
+        /// Tries to parse a port string.
+        /// </summary>
+        /// <param name="portIn">the port string to parse</param>
+        /// <param name="portOut">out parameter for the port as an Int16 if portIn is valid and undefined otherwise</param>
+        /// <returns>true iff portIn is a valid port</returns>
         public static bool tryParsePort(String portIn, out Int16 portOut)
         {
             return Int16.TryParse(portIn, out portOut);

+ 49 - 4
bbiwarg/Utility/ConvexityDefect.cs

@@ -8,20 +8,55 @@ using Emgu.CV.Structure;
 
 namespace bbiwarg.Utility
 {
+    /// <summary>
+    /// Stores data about and provides functions to work with convexity defects.
+    /// </summary>
     public class ConvexityDefect
     {
+        /// <summary>
+        /// the point of start and end point which is nearer to the depth point
+        /// </summary>
         public Vector2D OuterShort { get; private set; }
+        
+        /// <summary>
+        /// the point of start and end point which is farther away from the depth point
+        /// </summary>
         public Vector2D OuterLong { get; private set; }
+        
+        /// <summary>
+        /// the depth point
+        /// </summary>
         public Vector2D Inner { get; private set; }
+
+        /// <summary>
+        /// vector from Inner to OuterShort
+        /// </summary>
         public Vector2D VectorShort { get; private set; }
+
+        /// <summary>
+        /// vector from Inner to OuterLong
+        /// </summary>
         public Vector2D VectorLong { get; private set; }
+
+        /// <summary>
+        /// line segment from start to end point
+        /// </summary>
         public LineSegment2D OuterLineSegment { get; private set; }
+
+        /// <summary>
+        /// distance from OuterLineSegment to Inner
+        /// </summary>
         public float Depth { get; private set; }
 
-        public ConvexityDefect(MCvConvexityDefect mcvCOnvexityDefect) {
-            Inner = new Vector2D(mcvCOnvexityDefect.DepthPoint);
-            Vector2D p1 = new Vector2D(mcvCOnvexityDefect.StartPoint);
-            Vector2D p2 = new Vector2D(mcvCOnvexityDefect.EndPoint);
+
+        /// <summary>
+        /// Constructs a ConvexityDefect.
+        /// </summary>
+        /// <param name="mcvConvexityDefect">the emgu convexity defect which has start, end and depth point</param>
+        public ConvexityDefect(MCvConvexityDefect mcvConvexityDefect) {
+            Inner = new Vector2D(mcvConvexityDefect.DepthPoint);
+            Vector2D p1 = new Vector2D(mcvConvexityDefect.StartPoint);
+            Vector2D p2 = new Vector2D(mcvConvexityDefect.EndPoint);
 
             if ((p1 - Inner).Length > (p2 - Inner).Length)
             {
@@ -39,6 +74,11 @@ namespace bbiwarg.Utility
             Depth = OuterLineSegment.getDistanceTo(Inner);
         }
 
+        /// <summary>
+        /// Tests if this defect could be the defect near the thumb.
+        /// </summary>
+        /// <param name="thumb">finger representing the thumb</param>
+        /// <returns>true iff this defect is a possible thumb defect</returns>
         public bool isPossibleThumbDefect(Finger thumb) {
             float tipDistance = thumb.TipPoint.getDistanceTo(OuterShort);
             float handDistance = thumb.HandPoint.getDistanceTo(Inner);
@@ -51,6 +91,11 @@ namespace bbiwarg.Utility
                     shortLongLengthRatio <= Parameters.HandThumbDefectMaxShortLongLengthRatio && shortLongLengthRatio >= Parameters.HandThumbDefectMinShortLongLengthRatio);
         }
 
+        /// <summary>
+        /// Tests if this defect is caused by a finger.
+        /// </summary>
+        /// <param name="finger">the finger maybe causing the defect</param>
+        /// <returns>true iff this defect is caused by finger</returns>
         public bool isCausedByFinger(Finger finger) {
             return (OuterLineSegment.intersectsWith(finger.LineSegment));
         }

+ 48 - 0
bbiwarg/Utility/CoordinateConverter.cs

@@ -6,14 +6,43 @@ using System.Threading.Tasks;
 
 namespace bbiwarg.Utility
 {
+    /// <summary>
+    /// Converts between 2d and 3d coordinates.
+    /// </summary>
     public class CoordinateConverter
     {
+        /// <summary>
+        /// size of the image the coordinates are from
+        /// </summary>
         private ImageSize imageSize;
+
+        /// <summary>
+        /// the horizontal field of view angle
+        /// </summary>
         private float hfov;
+
+        /// <summary>
+        /// the vertical field of view angle
+        /// </summary>
         private float vfov;
+
+        /// <summary>
+        /// tangens of hfov / 2
+        /// </summary>
         private float hRatio;
+
+        /// <summary>
+        /// tanges of vfov / 2
+        /// </summary>
         private float vRatio;
 
+
+        /// <summary>
+        /// Constructs a CoordinateConverter.
+        /// </summary>
+        /// <param name="imageSize">size of the image the coordinates are from</param>
+        /// <param name="hfov">horizontal field of view angle</param>
+        /// <param name="vfov">vertical field of view angle</param>
         public CoordinateConverter(ImageSize imageSize, float hfov, float vfov)
         {
             this.imageSize = imageSize;
@@ -24,10 +53,23 @@ namespace bbiwarg.Utility
             vRatio = (float)Math.Tan(vfov / 2);
         }
 
+        /// <summary>
+        /// Converts a point with a depth to a 3d position.
+        /// </summary>
+        /// <param name="p">the point</param>
+        /// <param name="depth">the depth</param>
+        /// <returns>the 3d position</returns>
         public Vector3D convertCoordinate2Dto3D(Vector2D p, float depth) {
             return convertCoordinate2Dto3D(p.X, p.Y, depth);
         }
 
+        /// <summary>
+        /// Converts a position with a depth to a 3d position.
+        /// </summary>
+        /// <param name="x">x coordinate of the position</param>
+        /// <param name="y">y cooridnate of the position</param>
+        /// <param name="depth">the depth</param>
+        /// <returns>the 3d position</returns>
         public Vector3D convertCoordinate2Dto3D(float x, float y, float depth)
         {
             float deltaX = 2 * ((x / imageSize.Width) - 0.5f);
@@ -46,6 +88,12 @@ namespace bbiwarg.Utility
             return new Vector3D(x3, y3, z3);
         }
 
+        /// <summary>
+        /// Converts the length of a 3d linesegment parallel to the camera at the given depth to the length of the linesegment in 2d.
+        /// </summary>
+        /// <param name="length">3d length of the linesegment</param>
+        /// <param name="depth">depth of the linesegment</param>
+        /// <returns>2d length of the linesegment</returns>
         public float convertLength3Dto2D(float length, float depth) {
             float fullLengthX = (float)(2 * Math.Cos(hfov / 2) * depth);
             float fullLengthY = (float)(2 * Math.Cos(vfov / 2) * depth);

+ 38 - 0
bbiwarg/Utility/ImageSize.cs

@@ -7,24 +7,62 @@ using System.Threading.Tasks;
 
 namespace bbiwarg.Utility
 {
+    /// <summary>
+    /// Manages the size of a image.
+    /// </summary>
     public class ImageSize
     {
+        /// <summary>
+        /// image width
+        /// </summary>
         public int Width {get; private set;}
+
+        /// <summary>
+        /// image height
+        /// </summary>
         public int Height {get; private set;}
+
+        /// <summary>
+        /// position in the image with maximum x and y values
+        /// </summary>
         public Vector2D MaxPixel {get; private set;}
+
+        /// <summary>
+        /// the length of the longer image diagonal
+        /// </summary>
         public float DiagonalLength { get { return MaxPixel.Length; } }
+
+        /// <summary>
+        /// number of pixels in the image
+        /// </summary>
         public int NumPixels { get { return Width * Height; } }
 
+
+        /// <summary>
+        /// Constructs a ImageSize.
+        /// </summary>
+        /// <param name="width">image width</param>
+        /// <param name="height">image height</param>
         public ImageSize(int width, int height) {
             Width = width;
             Height = height;
             MaxPixel = new Vector2D(width - 1, height - 1);
         }
 
+        /// <summary>
+        /// Computes an absolute point in the image.
+        /// </summary>
+        /// <param name="relativePoint">realtive point (x and y in [0,1])</param>
+        /// <returns>absolute point</returns>
         public Vector2D getAbsolutePoint(Vector2D relativePoint) {
             return relativePoint.scale(MaxPixel);
         }
 
+        /// <summary>
+        /// Computes a relative point in the image.
+        /// </summary>
+        /// <param name="absolutePoint">absolute point in the image</param>
+        /// <returns>realtive point (x and y in [0,1])</returns>
         public Vector2D getRelativePoint(Vector2D absolutePoint) {
             return new Vector2D(absolutePoint.X / Width, absolutePoint.Y / Height);
         }

+ 60 - 2
bbiwarg/Utility/Kalman2DPositionFilter.cs

@@ -9,14 +9,49 @@ using Emgu.CV.Structure;
 
 namespace bbiwarg.Utility
 {
+    /// <summary>
+    /// Filter used to smooth a series of 2d positions.
+    /// </summary>
     class Kalman2DPositionFilter
     {
+        /// <summary>
+        /// the emgu kalman filter
+        /// </summary>
         private Kalman kalman;
-        private float mXX, mXY, mYY, processNoiseFactor;
+
+        /// <summary>
+        /// xx entry for the measurement noise covariance matrix
+        /// </summary>
+        private float mXX;
+
+        /// <summary>
+        /// xy and yx entry for the measurement noise covariance matrix
+        /// </summary>
+        private float mXY;
+
+        /// <summary>
+        /// yy entry for the measurement noise covariance matrix
+        /// </summary> 
+        private float mYY;
+        
+        /// <summary>
+        /// value used for all entries in the process noise covariance matrix
+        /// </summary>
+        private float processNoiseFactor;
+        
+
+        /// <summary>
+        /// number of measurements per second
+        /// </summary>
         private float fps;
 
+
+        /// <summary>
+        /// true iff the kalman filter is initialized
+        /// </summary>
         public bool Initialized { get; private set; }
 
+
         // state: x, y, v_x, v_y
         //   x: current x position
         //   y: current y position
@@ -24,6 +59,14 @@ namespace bbiwarg.Utility
         // v_y: velocity in y direction
         // a_x: acceleration in x direction
         // a_y: acceleration in y direction
+        /// <summary>
+        /// Creates a Kalman2DPositionFilter.
+        /// </summary>
+        /// <param name="mXX">xx entry for the measurement noise covariance matrix</param>
+        /// <param name="mXY">xy and yx entry for the measurement noise covariance matrix</param>
+        /// <param name="mYY">yy entry for the measurement noise covariance matrix</param>
+        /// <param name="processNoiseFactor">value used for all entries in the process noise covariance matrix</param>
+        /// <param name="fps">number of measurements per second</param>
         public Kalman2DPositionFilter(float mXX, float mXY, float mYY, float processNoiseFactor = 1.0e-4f, int fps = 30)
         {
             this.mXX = mXX;
@@ -34,6 +77,9 @@ namespace bbiwarg.Utility
             reset();
         }
 
+        /// <summary>
+        /// Resets the kalman filter.
+        /// </summary>
         public void reset()
         {
             // 6 state variables and 2 measurements (0 controls)
@@ -77,6 +123,10 @@ namespace bbiwarg.Utility
             Initialized = false;
         }
 
+        /// <summary>
+        /// Sets the initial position.
+        /// </summary>
+        /// <param name="initialPosition">initial position</param>
         public void setInitialPosition(Vector2D initialPosition)
         {
             // initial state (x, y, v_x, v_y)
@@ -86,13 +136,21 @@ namespace bbiwarg.Utility
             Initialized = true;
         }
 
+        /// <summary>
+        /// Computes a prediction for the next position based on the previous positions.
+        /// </summary>
+        /// <returns>prediction for the next position</returns>
         public Vector2D getPrediction()
         {
             Matrix<float> predicton = kalman.Predict();
             return new Vector2D(predicton[0, 0], predicton[1, 0]);
         }
 
-        // updates the filter and returns the corrected position
+        /// <summary>
+        /// Computes a smoothed position for a measurement and updates the filter.
+        /// </summary>
+        /// <param name="rawPosition">the measurement</param>
+        /// <returns>the smoothed position</returns>
         public Vector2D getCorrectedPosition(Vector2D rawPosition)
         {
             Matrix<float> rawPositionMatrix = new Matrix<float>(new float[,] 

+ 3 - 0
bbiwarg/Utility/Line2D.cs

@@ -6,6 +6,9 @@ using System.Threading.Tasks;
 
 namespace bbiwarg.Utility
 {
+    /// <summary>
+    /// Values for describing if something is on, above or below a line.
+    /// </summary>
     public enum LineSide
     {
         onLine = 0,

+ 47 - 1
bbiwarg/Utility/LineSegment2D.cs

@@ -6,15 +6,41 @@ using System.Threading.Tasks;
 
 namespace bbiwarg.Utility
 {
-
+    /// <summary>
+    /// Class to represent a segment of a line, a line between two points. 
+    /// </summary>
     public class LineSegment2D
     {
+        /// <summary>
+        /// first point of the lineSegment
+        /// </summary>
         public Vector2D P1 { get; private set; }
+
+        /// <summary>
+        /// second point of the lineSegment
+        /// </summary>
         public Vector2D P2 { get; private set; }
+
+        /// <summary>
+        /// Direction Vector of the line which contains the lineSegment
+        /// </summary>
         public Vector2D Direction { get { return Line.Direction; } }
+
+        /// <summary>
+        /// Line which contains the lineSegment
+        /// </summary>
         public Line2D Line { get; private set; }
+
+        /// <summary>
+        /// Length of the LineSegment
+        /// </summary>
         public float Length { get; private set; }
 
+        /// <summary>
+        /// 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>
         public LineSegment2D(Vector2D p1, Vector2D p2)
         {
             //endpoints
@@ -25,11 +51,21 @@ namespace bbiwarg.Utility
             Length = P1.getDistanceTo(P2);
         }
 
+        /// <summary>
+        /// 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>
         public bool intersectsWith(LineSegment2D ls) {
             Vector2D intersection = Line.getIntersection(ls.Line);
             return (intersection != null && intersection.isInBox(P1, P2) && intersection.isInBox(ls.P1, ls.P2));
         }
 
+        /// <summary>
+        /// 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>
         public float getParallelDistanceTo(LineSegment2D line)
         {
             if (Line.onSide(line.P1) != Line.onSide(line.P2)) return 0;
@@ -42,6 +78,11 @@ namespace bbiwarg.Utility
             return Math.Min(distanceA1, distanceA2);
         }
 
+        /// <summary>
+        /// Computes the vertical distance between two lineSegments. the vertical distance is the minimal distance between the LineSegments after they are projected on a horizontal line.
+        /// </summary>
+        /// <param name="line">second LineSegment</param>
+        /// <returns>the vertical distance</returns>
         public float getVerticalDistanceTo(LineSegment2D line)
         {
             Vector2D a1 = Line.projectToLine(line.P1);
@@ -56,6 +97,11 @@ namespace bbiwarg.Utility
             return Math.Min(Math.Min(distanceP1A1, distanceP1A2), Math.Min(distanceP2A1, distanceP2A2));
         }
 
+        /// <summary>
+        /// Computes the shortest distance of a point to the LineSegment
+        /// </summary>
+        /// <param name="point">the point for distance calculation</param>
+        /// <returns>the distance</returns>
         public float getDistanceTo(Vector2D point)
         {
             // http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment